Index: lldb/trunk/include/lldb/API/SBAddress.h =================================================================== --- lldb/trunk/include/lldb/API/SBAddress.h +++ lldb/trunk/include/lldb/API/SBAddress.h @@ -54,9 +54,9 @@ lldb::SBSymbolContext GetSymbolContext(uint32_t resolve_scope); // The following functions grab individual objects for a given address and - // are less efficient if you want more than one symbol related objects. - // Use one of the following when you want multiple debug symbol related - // objects for an address: + // are less efficient if you want more than one symbol related objects. Use + // one of the following when you want multiple debug symbol related objects + // for an address: // lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t // resolve_scope); // lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const Index: lldb/trunk/include/lldb/API/SBBroadcaster.h =================================================================== --- lldb/trunk/include/lldb/API/SBBroadcaster.h +++ lldb/trunk/include/lldb/API/SBBroadcaster.h @@ -46,17 +46,17 @@ bool RemoveListener(const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX); - // This comparison is checking if the internal opaque pointer value - // is equal to that in "rhs". + // This comparison is checking if the internal opaque pointer value is equal + // to that in "rhs". bool operator==(const lldb::SBBroadcaster &rhs) const; - // This comparison is checking if the internal opaque pointer value - // is not equal to that in "rhs". + // This comparison is checking if the internal opaque pointer value is not + // equal to that in "rhs". bool operator!=(const lldb::SBBroadcaster &rhs) const; - // This comparison is checking if the internal opaque pointer value - // is less than that in "rhs" so SBBroadcaster objects can be contained - // in ordered containers. + // This comparison is checking if the internal opaque pointer value is less + // than that in "rhs" so SBBroadcaster objects can be contained in ordered + // containers. bool operator<(const lldb::SBBroadcaster &rhs) const; protected: Index: lldb/trunk/include/lldb/API/SBCommandInterpreter.h =================================================================== --- lldb/trunk/include/lldb/API/SBCommandInterpreter.h +++ lldb/trunk/include/lldb/API/SBCommandInterpreter.h @@ -138,23 +138,20 @@ lldb::SBCommandReturnObject result); // The pointer based interface is not useful in SWIG, since the cursor & - // last_char arguments are string pointers INTO current_line - // and you can't do that in a scripting language interface in general... + // last_char arguments are string pointers INTO current_line and you can't do + // that in a scripting language interface in general... // In either case, the way this works is that the you give it a line and - // cursor position in the line. The function - // will return the number of completions. The matches list will contain - // number_of_completions + 1 elements. The first - // element is the common substring after the cursor position for all the - // matches. The rest of the elements are the - // matches. The first element is useful if you are emulating the common shell - // behavior where the tab completes - // to the string that is common among all the matches, then you should first - // check if the first element is non-empty, + // cursor position in the line. The function will return the number of + // completions. The matches list will contain number_of_completions + 1 + // elements. The first element is the common substring after the cursor + // position for all the matches. The rest of the elements are the matches. + // The first element is useful if you are emulating the common shell behavior + // where the tab completes to the string that is common among all the + // matches, then you should first check if the first element is non-empty, // and if so just insert it and move the cursor to the end of the insertion. - // The next tab will return an empty - // common substring, and a list of choices (if any), at which point you should - // display the choices and let the user + // The next tab will return an empty common substring, and a list of choices + // (if any), at which point you should display the choices and let the user // type further to disambiguate. int HandleCompletion(const char *current_line, const char *cursor, @@ -167,9 +164,9 @@ bool WasInterrupted() const; - // Catch commands before they execute by registering a callback that will - // get called when the command gets executed. This allows GUI or command - // line interfaces to intercept a command and stop it from happening + // Catch commands before they execute by registering a callback that will get + // called when the command gets executed. This allows GUI or command line + // interfaces to intercept a command and stop it from happening bool SetCommandOverrideCallback(const char *command_name, lldb::CommandOverrideCallback callback, void *baton); Index: lldb/trunk/include/lldb/API/SBCommandReturnObject.h =================================================================== --- lldb/trunk/include/lldb/API/SBCommandReturnObject.h +++ lldb/trunk/include/lldb/API/SBCommandReturnObject.h @@ -67,8 +67,7 @@ bool GetDescription(lldb::SBStream &description); - // deprecated, these two functions do not take - // ownership of file handle + // deprecated, these two functions do not take ownership of file handle void SetImmediateOutputFile(FILE *fh); void SetImmediateErrorFile(FILE *fh); Index: lldb/trunk/include/lldb/API/SBData.h =================================================================== --- lldb/trunk/include/lldb/API/SBData.h +++ lldb/trunk/include/lldb/API/SBData.h @@ -71,11 +71,10 @@ lldb::addr_t base_addr = LLDB_INVALID_ADDRESS); // it would be nice to have SetData(SBError, const void*, size_t) when - // endianness and address size can be - // inferred from the existing DataExtractor, but having two SetData() - // signatures triggers a SWIG bug where - // the typemap isn't applied before resolving the overload, and thus the right - // function never gets called + // endianness and address size can be inferred from the existing + // DataExtractor, but having two SetData() signatures triggers a SWIG bug + // where the typemap isn't applied before resolving the overload, and thus + // the right function never gets called void SetData(lldb::SBError &error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size); @@ -87,9 +86,8 @@ const char *data); // in the following CreateData*() and SetData*() prototypes, the two - // parameters array and array_len - // should not be renamed or rearranged, because doing so will break the SWIG - // typemap + // parameters array and array_len should not be renamed or rearranged, + // because doing so will break the SWIG typemap static lldb::SBData CreateDataFromUInt64Array(lldb::ByteOrder endian, uint32_t addr_byte_size, uint64_t *array, Index: lldb/trunk/include/lldb/API/SBExpressionOptions.h =================================================================== --- lldb/trunk/include/lldb/API/SBExpressionOptions.h +++ lldb/trunk/include/lldb/API/SBExpressionOptions.h @@ -51,10 +51,8 @@ uint32_t GetOneThreadTimeoutInMicroSeconds() const; // Set the timeout for running on one thread, 0 means use the default - // behavior. - // If you set this higher than the overall timeout, you'll get an error when - // you - // try to run the expression. + // behavior. If you set this higher than the overall timeout, you'll get an + // error when you try to run the expression. void SetOneThreadTimeoutInMicroSeconds(uint32_t timeout = 0); bool GetTryAllThreads() const; Index: lldb/trunk/include/lldb/API/SBFrame.h =================================================================== --- lldb/trunk/include/lldb/API/SBFrame.h +++ lldb/trunk/include/lldb/API/SBFrame.h @@ -153,10 +153,10 @@ lldb::DynamicValueType use_dynamic); // Find a value for a variable expression path like "rect.origin.x" or - // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ - // and expression result and is not a constant object like - // SBFrame::EvaluateExpression(...) returns, but a child object of - // the variable value. + // "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_ and + // expression result and is not a constant object like + // SBFrame::EvaluateExpression(...) returns, but a child object of the + // variable value. lldb::SBValue GetValueForVariablePath(const char *var_expr_cstr, DynamicValueType use_dynamic); Index: lldb/trunk/include/lldb/API/SBInstruction.h =================================================================== --- lldb/trunk/include/lldb/API/SBInstruction.h +++ lldb/trunk/include/lldb/API/SBInstruction.h @@ -16,8 +16,7 @@ #include // There's a lot to be fixed here, but need to wait for underlying insn -// implementation -// to be revised & settle down first. +// implementation to be revised & settle down first. class InstructionImpl; Index: lldb/trunk/include/lldb/API/SBInstructionList.h =================================================================== --- lldb/trunk/include/lldb/API/SBInstructionList.h +++ lldb/trunk/include/lldb/API/SBInstructionList.h @@ -33,8 +33,8 @@ lldb::SBInstruction GetInstructionAtIndex(uint32_t idx); // ---------------------------------------------------------------------- - // Returns the number of instructions between the start and end address. - // If canSetBreakpoint is true then the count will be the number of + // Returns the number of instructions between the start and end address. If + // canSetBreakpoint is true then the count will be the number of // instructions on which a breakpoint can be set. // ---------------------------------------------------------------------- size_t GetInstructionsCount(const SBAddress &start, Index: lldb/trunk/include/lldb/API/SBProcess.h =================================================================== --- lldb/trunk/include/lldb/API/SBProcess.h +++ lldb/trunk/include/lldb/API/SBProcess.h @@ -98,10 +98,10 @@ lldb::SBThread GetSelectedThread() const; //------------------------------------------------------------------ - // Function for lazily creating a thread using the current OS - // plug-in. This function will be removed in the future when there - // are APIs to create SBThread objects through the interface and add - // them to the process through the SBProcess API. + // Function for lazily creating a thread using the current OS plug-in. This + // function will be removed in the future when there are APIs to create + // SBThread objects through the interface and add them to the process through + // the SBProcess API. //------------------------------------------------------------------ lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context); Index: lldb/trunk/include/lldb/API/SBStream.h =================================================================== --- lldb/trunk/include/lldb/API/SBStream.h +++ lldb/trunk/include/lldb/API/SBStream.h @@ -26,13 +26,12 @@ bool IsValid() const; - // If this stream is not redirected to a file, it will maintain a local - // cache for the stream data which can be accessed using this accessor. + // If this stream is not redirected to a file, it will maintain a local cache + // for the stream data which can be accessed using this accessor. const char *GetData(); - // If this stream is not redirected to a file, it will maintain a local - // cache for the stream output whose length can be accessed using this - // accessor. + // If this stream is not redirected to a file, it will maintain a local cache + // for the stream output whose length can be accessed using this accessor. size_t GetSize(); void Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); @@ -44,8 +43,8 @@ void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership); // If the stream is redirected to a file, forget about the file and if - // ownership of the file was transferred to this object, close the file. - // If the stream is backed by a local cache, clear this cache. + // ownership of the file was transferred to this object, close the file. If + // the stream is backed by a local cache, clear this cache. void Clear(); protected: Index: lldb/trunk/include/lldb/API/SBSymbol.h =================================================================== --- lldb/trunk/include/lldb/API/SBSymbol.h +++ lldb/trunk/include/lldb/API/SBSymbol.h @@ -55,8 +55,8 @@ bool GetDescription(lldb::SBStream &description); //---------------------------------------------------------------------- - // Returns true if the symbol is externally visible in the module that - // it is defined in + // Returns true if the symbol is externally visible in the module that it is + // defined in //---------------------------------------------------------------------- bool IsExternal(); Index: lldb/trunk/include/lldb/API/SBTarget.h =================================================================== --- lldb/trunk/include/lldb/API/SBTarget.h +++ lldb/trunk/include/lldb/API/SBTarget.h @@ -775,8 +775,7 @@ const void *buf, size_t size); // The "WithFlavor" is necessary to keep SWIG from getting confused about - // overloaded arguments when - // using the buf + size -> Python Object magic. + // overloaded arguments when using the buf + size -> Python Object magic. lldb::SBInstructionList GetInstructionsWithFlavor(lldb::SBAddress base_addr, const char *flavor_string, @@ -829,8 +828,8 @@ friend class SBValue; //------------------------------------------------------------------ - // Constructors are private, use static Target::Create function to - // create an instance of this class. + // Constructors are private, use static Target::Create function to create an + // instance of this class. //------------------------------------------------------------------ lldb::TargetSP GetSP() const; Index: lldb/trunk/include/lldb/API/SBValue.h =================================================================== --- lldb/trunk/include/lldb/API/SBValue.h +++ lldb/trunk/include/lldb/API/SBValue.h @@ -134,8 +134,7 @@ lldb::SBType type); // this has no address! GetAddress() and GetLoadAddress() as well as - // AddressOf() - // on the return of this call all return invalid + // AddressOf() on the return of this call all return invalid lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, lldb::SBType type); Index: lldb/trunk/include/lldb/API/SBValueList.h =================================================================== --- lldb/trunk/include/lldb/API/SBValueList.h +++ lldb/trunk/include/lldb/API/SBValueList.h @@ -43,8 +43,8 @@ const lldb::SBValueList &operator=(const lldb::SBValueList &rhs); protected: - // only useful for visualizing the pointer or comparing two SBValueLists - // to see if they are backed by the same underlying Impl. + // only useful for visualizing the pointer or comparing two SBValueLists to + // see if they are backed by the same underlying Impl. void *opaque_ptr(); private: Index: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h +++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h @@ -214,8 +214,8 @@ void Dump(Stream *s) override; //------------------------------------------------------------------ - // The next set of methods provide ways to tell the breakpoint to update - // it's location list - usually done when modules appear or disappear. + // The next set of methods provide ways to tell the breakpoint to update it's + // location list - usually done when modules appear or disappear. //------------------------------------------------------------------ //------------------------------------------------------------------ @@ -287,8 +287,8 @@ lldb::ModuleSP new_module_sp); //------------------------------------------------------------------ - // The next set of methods provide access to the breakpoint locations - // for this breakpoint. + // The next set of methods provide access to the breakpoint locations for + // this breakpoint. //------------------------------------------------------------------ //------------------------------------------------------------------ @@ -744,10 +744,10 @@ void DecrementIgnoreCount(); // BreakpointLocation::IgnoreCountShouldStop & - // Breakpoint::IgnoreCountShouldStop can only be called once per stop, - // and BreakpointLocation::IgnoreCountShouldStop should be tested first, and - // if it returns false we should - // continue, otherwise we should test Breakpoint::IgnoreCountShouldStop. + // Breakpoint::IgnoreCountShouldStop can only be called once per stop, and + // BreakpointLocation::IgnoreCountShouldStop should be tested first, and if + // it returns false we should continue, otherwise we should test + // Breakpoint::IgnoreCountShouldStop. bool IgnoreCountShouldStop(); @@ -760,8 +760,7 @@ private: // This one should only be used by Target to copy breakpoints from target to - // target - primarily from the dummy - // target to prime new targets. + // target - primarily from the dummy target to prime new targets. Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from); //------------------------------------------------------------------ @@ -782,9 +781,9 @@ BreakpointPreconditionSP m_precondition_sp; // The precondition is a // breakpoint-level hit filter // that can be used - // to skip certain breakpoint hits. For instance, exception breakpoints - // use this to limit the stop to certain exception classes, while leaving - // the condition & callback free for user specification. + // to skip certain breakpoint hits. For instance, exception breakpoints use + // this to limit the stop to certain exception classes, while leaving the + // condition & callback free for user specification. std::unique_ptr m_options_up; // Settable breakpoint options BreakpointLocationList Index: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h @@ -384,8 +384,7 @@ //------------------------------------------------------------------ // Constructors and Destructors // - // Only the Breakpoint can make breakpoint locations, and it owns - // them. + // Only the Breakpoint can make breakpoint locations, and it owns them. //------------------------------------------------------------------ //------------------------------------------------------------------ Index: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -178,8 +178,8 @@ protected: //------------------------------------------------------------------ - // Classes that inherit from BreakpointLocationCollection can see - // and modify these + // Classes that inherit from BreakpointLocationCollection can see and modify + // these //------------------------------------------------------------------ private: Index: lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocationList.h @@ -34,13 +34,11 @@ //---------------------------------------------------------------------- class BreakpointLocationList { - // Only Breakpoints can make the location list, or add elements to it. - // This is not just some random collection of locations. Rather, the act of - // adding the location - // to this list sets its ID, and implicitly all the locations have the same - // breakpoint ID as - // well. If you need a generic container for breakpoint locations, use - // BreakpointLocationCollection. + // Only Breakpoints can make the location list, or add elements to it. This + // is not just some random collection of locations. Rather, the act of + // adding the location to this list sets its ID, and implicitly all the + // locations have the same breakpoint ID as well. If you need a generic + // container for breakpoint locations, use BreakpointLocationCollection. friend class Breakpoint; public: Index: lldb/trunk/include/lldb/Breakpoint/BreakpointName.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointName.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointName.h @@ -80,8 +80,8 @@ *this = Permissions(); } - // Merge the permissions from incoming into this set of permissions. - // Only merge set permissions, and most restrictive permission wins. + // Merge the permissions from incoming into this set of permissions. Only + // merge set permissions, and most restrictive permission wins. void MergeInto(const Permissions &incoming) { MergePermission(incoming, listPerm); Index: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h @@ -156,18 +156,16 @@ // Callbacks // // Breakpoint callbacks come in two forms, synchronous and asynchronous. - // Synchronous callbacks will get - // run before any of the thread plans are consulted, and if they return false - // the target will continue - // "under the radar" of the thread plans. There are a couple of restrictions - // to synchronous callbacks: - // 1) They should NOT resume the target themselves. Just return false if you - // want the target to restart. - // 2) Breakpoints with synchronous callbacks can't have conditions (or rather, - // they can have them, but they - // won't do anything. Ditto with ignore counts, etc... You are supposed - // to control that all through the - // callback. + // Synchronous callbacks will get run before any of the thread plans are + // consulted, and if they return false the target will continue "under the + // radar" of the thread plans. There are a couple of restrictions to + // synchronous callbacks: + // 1) They should NOT resume the target themselves. + // Just return false if you want the target to restart. + // 2) Breakpoints with synchronous callbacks can't have conditions + // (or rather, they can have them, but they won't do anything. + // Ditto with ignore counts, etc... You are supposed to control that all + // through the callback. // Asynchronous callbacks get run as part of the "ShouldStop" logic in the // thread plan. The logic there is: // a) If the breakpoint is thread specific and not for this thread, continue @@ -181,12 +179,10 @@ // b) If the ignore count says we shouldn't stop, then ditto. // c) If the condition says we shouldn't stop, then ditto. // d) Otherwise, the callback will get run, and if it returns true we will - // stop, and if false we won't. + // stop, and if false we won't. // The asynchronous callback can run the target itself, but at present that - // should be the last action the - // callback does. We will relax this condition at some point, but it will - // take a bit of plumbing to get - // that to work. + // should be the last action the callback does. We will relax this condition + // at some point, but it will take a bit of plumbing to get that to work. // //------------------------------------------------------------------ @@ -227,8 +223,8 @@ //------------------------------------------------------------------ void ClearCallback(); - // The rest of these functions are meant to be used only within the breakpoint - // handling mechanism. + // The rest of these functions are meant to be used only within the + // breakpoint handling mechanism. //------------------------------------------------------------------ /// Use this function to invoke the callback for a specific stop. Index: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h @@ -171,8 +171,8 @@ UnknownResolver }; - // Translate the Ty to name for serialization, - // the "+2" is one for size vrs. index, and one for UnknownResolver. + // Translate the Ty to name for serialization, the "+2" is one for size vrs. + // index, and one for UnknownResolver. static const char *g_ty_to_name[LastKnownResolverType + 2]; //------------------------------------------------------------------ @@ -199,8 +199,8 @@ protected: // Used for serializing resolver options: - // The options in this enum and the strings in the - // g_option_names must be kept in sync. + // The options in this enum and the strings in the g_option_names must be + // kept in sync. enum class OptionNames : uint32_t { AddressOffset = 0, ExactMatch, Index: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -74,8 +74,7 @@ FileSpec m_module_filespec; // If this filespec is Valid, and m_addr is an // offset, then it will be converted // to a Section+Offset address in this module, whenever that module gets - // around to - // being loaded. + // around to being loaded. private: DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress); }; Index: lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolverName.h @@ -48,8 +48,8 @@ uint32_t name_type_mask, lldb::LanguageType language, lldb::addr_t offset, bool skip_prologue); - // Creates a function breakpoint by regular expression. Takes over control of - // the lifespan of func_regex. + // Creates a function breakpoint by regular expression. Takes over control + // of the lifespan of func_regex. BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex, lldb::LanguageType language, lldb::addr_t offset, bool skip_prologue); Index: lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h +++ lldb/trunk/include/lldb/Breakpoint/BreakpointSite.h @@ -241,9 +241,9 @@ private: friend class Process; friend class BreakpointLocation; - // The StopInfoBreakpoint knows when it is processing a hit for a thread for a - // site, so let it be the - // one to manage setting the location hit count once and only once. + // The StopInfoBreakpoint knows when it is processing a hit for a thread for + // a site, so let it be the one to manage setting the location hit count once + // and only once. friend class StopInfoBreakpoint; void BumpHitCounts(); @@ -264,8 +264,8 @@ bool m_enabled; ///< Boolean indicating if this breakpoint site enabled or not. - // Consider adding an optimization where if there is only one - // owner, we don't store a list. The usual case will be only one owner... + // Consider adding an optimization where if there is only one owner, we don't + // store a list. The usual case will be only one owner... BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations ///that share this breakpoint site. std::recursive_mutex Index: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h +++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h @@ -77,8 +77,8 @@ // breakpoint/watchpoint uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length // of the trap opcode for - // software breakpoints, or the optional length in bytes for - // hardware breakpoints, or the length of the watchpoint. + // software breakpoints, or the optional length in bytes for hardware + // breakpoints, or the length of the watchpoint. uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit Index: lldb/trunk/include/lldb/Breakpoint/Watchpoint.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/Watchpoint.h +++ lldb/trunk/include/lldb/Breakpoint/Watchpoint.h @@ -71,9 +71,9 @@ bool IsEnabled() const; - // This doesn't really enable/disable the watchpoint. - // It is currently just for use in the Process plugin's - // {Enable,Disable}Watchpoint, which should be used instead. + // This doesn't really enable/disable the watchpoint. It is currently just + // for use in the Process plugin's {Enable,Disable}Watchpoint, which should + // be used instead. void SetEnabled(bool enabled, bool notify = true); @@ -197,10 +197,8 @@ uint32_t m_disabled_count; // Keep track of the count that the watchpoint is // disabled while in ephemeral mode. // At the end of the ephemeral mode when the watchpoint is to be enabled - // again, - // we check the count, if it is more than 1, it means the user-supplied - // actions - // actually want the watchpoint to be disabled! + // again, we check the count, if it is more than 1, it means the user- + // supplied actions actually want the watchpoint to be disabled! uint32_t m_watch_read : 1, // 1 if we stop when the watched data is read from m_watch_write : 1, // 1 if we stop when the watched data is written to m_watch_was_read : 1, // Set to 1 when watchpoint is hit for a read access Index: lldb/trunk/include/lldb/Breakpoint/WatchpointList.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointList.h +++ lldb/trunk/include/lldb/Breakpoint/WatchpointList.h @@ -31,9 +31,9 @@ //---------------------------------------------------------------------- class WatchpointList { - // Only Target can make the watchpoint list, or add elements to it. - // This is not just some random collection of watchpoints. Rather, the act of - // adding the watchpoint to this list sets its ID. + // Only Target can make the watchpoint list, or add elements to it. This is + // not just some random collection of watchpoints. Rather, the act of adding + // the watchpoint to this list sets its ID. friend class Watchpoint; friend class Target; Index: lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h =================================================================== --- lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h +++ lldb/trunk/include/lldb/Breakpoint/WatchpointOptions.h @@ -69,15 +69,13 @@ // Callbacks // // Watchpoint callbacks come in two forms, synchronous and asynchronous. - // Synchronous callbacks will get - // run before any of the thread plans are consulted, and if they return false - // the target will continue - // "under the radar" of the thread plans. There are a couple of restrictions - // to synchronous callbacks: - // 1) They should NOT resume the target themselves. Just return false if you - // want the target to restart. - // 2) Watchpoints with synchronous callbacks can't have conditions (or rather, - // they can have them, but they + // Synchronous callbacks will get run before any of the thread plans are + // consulted, and if they return false the target will continue "under the + // radar" of the thread plans. There are a couple of restrictions to + // synchronous callbacks: 1) They should NOT resume the target themselves. + // Just return false if you want the target to restart. 2) Watchpoints with + // synchronous callbacks can't have conditions (or rather, they can have + // them, but they // won't do anything. Ditto with ignore counts, etc... You are supposed // to control that all through the // callback. @@ -118,8 +116,8 @@ //------------------------------------------------------------------ void ClearCallback(); - // The rest of these functions are meant to be used only within the watchpoint - // handling mechanism. + // The rest of these functions are meant to be used only within the + // watchpoint handling mechanism. //------------------------------------------------------------------ /// Use this function to invoke the callback for a specific stop. Index: lldb/trunk/include/lldb/Core/Address.h =================================================================== --- lldb/trunk/include/lldb/Core/Address.h +++ lldb/trunk/include/lldb/Core/Address.h @@ -531,11 +531,11 @@ bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const; //------------------------------------------------------------------ - // Returns true if the section should be valid, but isn't because - // the shared pointer to the section can't be reconstructed from - // a weak pointer that contains a valid weak reference to a section. - // Returns false if the section weak pointer has no reference to - // a section, or if the section is still valid + // Returns true if the section should be valid, but isn't because the shared + // pointer to the section can't be reconstructed from a weak pointer that + // contains a valid weak reference to a section. Returns false if the section + // weak pointer has no reference to a section, or if the section is still + // valid //------------------------------------------------------------------ bool SectionWasDeleted() const; @@ -547,29 +547,27 @@ lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid... //------------------------------------------------------------------ - // Returns true if the m_section_wp once had a reference to a valid - // section shared pointer, but no longer does. This can happen if - // we have an address from a module that gets unloaded and deleted. - // This function should only be called if GetSection() returns an - // empty shared pointer and you want to know if this address used to - // have a valid section. + // Returns true if the m_section_wp once had a reference to a valid section + // shared pointer, but no longer does. This can happen if we have an address + // from a module that gets unloaded and deleted. This function should only be + // called if GetSection() returns an empty shared pointer and you want to + // know if this address used to have a valid section. //------------------------------------------------------------------ bool SectionWasDeletedPrivate() const; }; //---------------------------------------------------------------------- // NOTE: Be careful using this operator. It can correctly compare two -// addresses from the same Module correctly. It can't compare two -// addresses from different modules in any meaningful way, but it will -// compare the module pointers. +// addresses from the same Module correctly. It can't compare two addresses +// from different modules in any meaningful way, but it will compare the module +// pointers. // // To sum things up: -// - works great for addresses within the same module -// - it works for addresses across multiple modules, but don't expect the +// - works great for addresses within the same module - it works for addresses +// across multiple modules, but don't expect the // address results to make much sense // -// This basically lets Address objects be used in ordered collection -// classes. +// This basically lets Address objects be used in ordered collection classes. //---------------------------------------------------------------------- bool operator<(const Address &lhs, const Address &rhs); bool operator>(const Address &lhs, const Address &rhs); Index: lldb/trunk/include/lldb/Core/AddressRange.h =================================================================== --- lldb/trunk/include/lldb/Core/AddressRange.h +++ lldb/trunk/include/lldb/Core/AddressRange.h @@ -261,8 +261,8 @@ /// The number of bytes that this object occupies in memory. //------------------------------------------------------------------ size_t MemorySize() const { - // Noting special for the memory size of a single AddressRange object, - // it is just the size of itself. + // Noting special for the memory size of a single AddressRange object, it + // is just the size of itself. return sizeof(AddressRange); } Index: lldb/trunk/include/lldb/Core/AddressResolverName.h =================================================================== --- lldb/trunk/include/lldb/Core/AddressResolverName.h +++ lldb/trunk/include/lldb/Core/AddressResolverName.h @@ -41,8 +41,8 @@ AddressResolverName(const char *func_name, AddressResolver::MatchType type = Exact); - // Creates a function breakpoint by regular expression. Takes over control of - // the lifespan of func_regex. + // Creates a function breakpoint by regular expression. Takes over control + // of the lifespan of func_regex. AddressResolverName(RegularExpression &func_regex); AddressResolverName(const char *class_name, const char *method, Index: lldb/trunk/include/lldb/Core/Broadcaster.h =================================================================== --- lldb/trunk/include/lldb/Core/Broadcaster.h +++ lldb/trunk/include/lldb/Core/Broadcaster.h @@ -59,10 +59,9 @@ uint32_t GetEventBits() const { return m_event_bits; } - // Tell whether this BroadcastEventSpec is contained in in_spec. - // That is: - // (a) the two spec's share the same broadcaster class - // (b) the event bits of this spec are wholly contained in those of in_spec. + // Tell whether this BroadcastEventSpec is contained in in_spec. That is: (a) + // the two spec's share the same broadcaster class (b) the event bits of this + // spec are wholly contained in those of in_spec. bool IsContainedIn(BroadcastEventSpec in_spec) const { if (m_broadcaster_class != in_spec.GetBroadcasterClass()) return false; @@ -454,8 +453,7 @@ void RestoreBroadcaster() { m_broadcaster_sp->RestoreBroadcaster(); } // This needs to be filled in if you are going to register the broadcaster - // with the broadcaster - // manager and do broadcaster class matching. + // with the broadcaster manager and do broadcaster class matching. // FIXME: Probably should make a ManagedBroadcaster subclass with all the bits // needed to work // with the BroadcasterManager, so that it is clearer how to add one. @@ -465,21 +463,17 @@ protected: // BroadcasterImpl contains the actual Broadcaster implementation. The - // Broadcaster makes a BroadcasterImpl - // which lives as long as it does. The Listeners & the Events hold a weak - // pointer to the BroadcasterImpl, - // so that they can survive if a Broadcaster they were listening to is - // destroyed w/o their being able to - // unregister from it (which can happen if the Broadcasters & Listeners are - // being destroyed on separate threads - // simultaneously. - // The Broadcaster itself can't be shared out as a weak pointer, because some - // things that are broadcasters - // (e.g. the Target and the Process) are shared in their own right. + // Broadcaster makes a BroadcasterImpl which lives as long as it does. The + // Listeners & the Events hold a weak pointer to the BroadcasterImpl, so that + // they can survive if a Broadcaster they were listening to is destroyed w/o + // their being able to unregister from it (which can happen if the + // Broadcasters & Listeners are being destroyed on separate threads + // simultaneously. The Broadcaster itself can't be shared out as a weak + // pointer, because some things that are broadcasters (e.g. the Target and + // the Process) are shared in their own right. // // For the most part, the Broadcaster functions dispatch to the - // BroadcasterImpl, and are documented in the - // public Broadcaster API above. + // BroadcasterImpl, and are documented in the public Broadcaster API above. class BroadcasterImpl { friend class Listener; Index: lldb/trunk/include/lldb/Core/Debugger.h =================================================================== --- lldb/trunk/include/lldb/Core/Debugger.h +++ lldb/trunk/include/lldb/Core/Debugger.h @@ -156,11 +156,9 @@ lldb::ListenerSP GetListener() { return m_listener_sp; } // This returns the Debugger's scratch source manager. It won't be able to - // look up files in debug - // information, but it can look up files by absolute path and display them to - // you. - // To get the target's source manager, call GetSourceManager on the target - // instead. + // look up files in debug information, but it can look up files by absolute + // path and display them to you. To get the target's source manager, call + // GetSourceManager on the target instead. SourceManager &GetSourceManager(); lldb::TargetSP GetSelectedTarget() { @@ -188,9 +186,8 @@ void DispatchInputEndOfFile(); //------------------------------------------------------------------ - // If any of the streams are not set, set them to the in/out/err - // stream of the top most input reader to ensure they at least have - // something + // If any of the streams are not set, set them to the in/out/err stream of + // the top most input reader to ensure they at least have something //------------------------------------------------------------------ void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in, lldb::StreamFileSP &out, @@ -323,9 +320,8 @@ Status RunREPL(lldb::LanguageType language, const char *repl_options); // This is for use in the command interpreter, when you either want the - // selected target, or if no target - // is present you want to prime the dummy target with entities that will be - // copied over to new targets. + // selected target, or if no target is present you want to prime the dummy + // target with entities that will be copied over to new targets. Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); Target *GetDummyTarget(); @@ -378,8 +374,8 @@ lldb::BroadcasterManagerSP m_broadcaster_manager_sp; // The debugger acts as a // broadcaster manager of // last resort. - // It needs to get constructed before the target_list or any other - // member that might want to broadcast through the debugger. + // It needs to get constructed before the target_list or any other member + // that might want to broadcast through the debugger. TerminalState m_terminal_state; TargetList m_target_list; @@ -418,8 +414,8 @@ }; private: - // Use Debugger::CreateInstance() to get a shared pointer to a new - // debugger object + // Use Debugger::CreateInstance() to get a shared pointer to a new debugger + // object Debugger(lldb::LogOutputCallback m_log_callback, void *baton); DISALLOW_COPY_AND_ASSIGN(Debugger); Index: lldb/trunk/include/lldb/Core/Disassembler.h =================================================================== --- lldb/trunk/include/lldb/Core/Disassembler.h +++ lldb/trunk/include/lldb/Core/Disassembler.h @@ -105,8 +105,7 @@ lldb::AddressClass GetAddressClass(); void SetAddress(const Address &addr) { - // Invalidate the address class to lazily discover - // it if we need to. + // Invalidate the address class to lazily discover it if we need to. m_address_class = lldb::eAddressClassInvalid; m_address = addr; } @@ -235,11 +234,12 @@ protected: Address m_address; // The section offset address of this instruction // We include an address class in the Instruction class to - // allow the instruction specify the eAddressClassCodeAlternateISA - // (currently used for thumb), and also to specify data (eAddressClassData). - // The usual value will be eAddressClassCode, but often when - // disassembling memory, you might run into data. This can - // help us to disassemble appropriately. + // allow the instruction specify the + // eAddressClassCodeAlternateISA (currently used for + // thumb), and also to specify data (eAddressClassData). + // The usual value will be eAddressClassCode, but often + // when disassembling memory, you might run into data. + // This can help us to disassemble appropriately. private: lldb::AddressClass m_address_class; // Use GetAddressClass () accessor function! @@ -365,12 +365,10 @@ }; // FindPlugin should be lax about the flavor string (it is too annoying to - // have various internal uses of the - // disassembler fail because the global flavor string gets set wrong. - // Instead, if you get a flavor string you + // have various internal uses of the disassembler fail because the global + // flavor string gets set wrong. Instead, if you get a flavor string you // don't understand, use the default. Folks who care to check can use the - // FlavorValidForArchSpec method on the - // disassembler they got back. + // FlavorValidForArchSpec method on the disassembler they got back. static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch, const char *flavor, const char *plugin_name); @@ -470,8 +468,8 @@ const char *flavor) = 0; protected: - // SourceLine and SourceLinesToDisplay structures are only used in - // the mixed source and assembly display methods internal to this class. + // SourceLine and SourceLinesToDisplay structures are only used in the mixed + // source and assembly display methods internal to this class. struct SourceLine { FileSpec file; @@ -494,9 +492,9 @@ struct SourceLinesToDisplay { std::vector lines; - // index of the "current" source line, if we want to highlight that - // when displaying the source lines. (as opposed to the surrounding - // source lines provided to give context) + // index of the "current" source line, if we want to highlight that when + // displaying the source lines. (as opposed to the surrounding source + // lines provided to give context) size_t current_source_line; // Whether to print a blank line at the end of the source lines. @@ -507,8 +505,8 @@ } }; - // Get the function's declaration line number, hopefully a line number earlier - // than the opening curly brace at the start of the function body. + // Get the function's declaration line number, hopefully a line number + // earlier than the opening curly brace at the start of the function body. static SourceLine GetFunctionDeclLineEntry(const SymbolContext &sc); // Add the provided SourceLine to the map of filenames-to-source-lines-seen. @@ -517,14 +515,13 @@ std::map> &source_lines_seen); // Given a source line, determine if we should print it when we're doing - // mixed source & assembly output. - // We're currently using the target.process.thread.step-avoid-regexp setting - // (which is used for stepping over inlined STL functions by default) to - // determine what source lines to avoid showing. + // mixed source & assembly output. We're currently using the + // target.process.thread.step-avoid-regexp setting (which is used for + // stepping over inlined STL functions by default) to determine what source + // lines to avoid showing. // // Returns true if this source line should be elided (if the source line - // should - // not be displayed). + // should not be displayed). static bool ElideMixedSourceAndDisassemblyLine(const ExecutionContext &exe_ctx, const SymbolContext &sc, SourceLine &line); Index: lldb/trunk/include/lldb/Core/EmulateInstruction.h =================================================================== --- lldb/trunk/include/lldb/Core/EmulateInstruction.h +++ lldb/trunk/include/lldb/Core/EmulateInstruction.h @@ -125,8 +125,8 @@ // prologue eContextPushRegisterOnStack, - // Exclusively used when restoring a register off the stack as part of - // the epilogue + // Exclusively used when restoring a register off the stack as part of the + // epilogue eContextPopRegisterOffStack, // Add or subtract a value from the stack @@ -135,8 +135,8 @@ // Adjust the frame pointer for the current frame eContextSetFramePointer, - // Typically in an epilogue sequence. Copy the frame pointer back - // into the stack pointer, use SP for CFA calculations again. + // Typically in an epilogue sequence. Copy the frame pointer back into the + // stack pointer, use SP for CFA calculations again. eContextRestoreStackPointer, // Add or subtract a value from a base address register (other than SP) @@ -159,8 +159,8 @@ // Used when performing an absolute branch where the eContextAbsoluteBranchRegister, - // Used when performing a supervisor call to an operating system to - // provide a service: + // Used when performing a supervisor call to an operating system to provide + // a service: eContextSupervisorCall, // Used when performing a MemU operation to read the PC-relative offset @@ -360,9 +360,8 @@ const RegisterValue ®_value); // Type to represent the condition of an instruction. The UINT32 value is - // reserved for the - // unconditional case and all other value can be used in an architecture - // dependent way. + // reserved for the unconditional case and all other value can be used in an + // architecture dependent way. typedef uint32_t InstructionCondition; static const InstructionCondition UnconditionalCondition = UINT32_MAX; Index: lldb/trunk/include/lldb/Core/FormatEntity.h =================================================================== --- lldb/trunk/include/lldb/Core/FormatEntity.h +++ lldb/trunk/include/lldb/Core/FormatEntity.h @@ -218,10 +218,10 @@ //---------------------------------------------------------------------- // Format the current elements into the stream \a s. // - // The root element will be stripped off and the format str passed in - // will be either an empty string (print a description of this object), - // or contain a . separated series like a domain name that identifies - // further sub elements to display. + // The root element will be stripped off and the format str passed in will be + // either an empty string (print a description of this object), or contain a + // `.`-separated series like a domain name that identifies further + // sub-elements to display. //---------------------------------------------------------------------- static bool FormatFileSpec(const FileSpec &file, Stream &s, llvm::StringRef elements, Index: lldb/trunk/include/lldb/Core/IOHandler.h =================================================================== --- lldb/trunk/include/lldb/Core/IOHandler.h +++ lldb/trunk/include/lldb/Core/IOHandler.h @@ -63,14 +63,13 @@ virtual ~IOHandler(); - // Each IOHandler gets to run until it is done. It should read data - // from the "in" and place output into "out" and "err and return - // when done. + // Each IOHandler gets to run until it is done. It should read data from the + // "in" and place output into "out" and "err and return when done. virtual void Run() = 0; - // Called when an input reader should relinquish its control so another - // can be pushed onto the IO handler stack, or so the current IO - // handler can pop itself off the stack + // Called when an input reader should relinquish its control so another can + // be pushed onto the IO handler stack, or so the current IO handler can pop + // itself off the stack virtual void Cancel() = 0; @@ -273,8 +272,8 @@ //------------------------------------------------------------------ virtual bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) { - // Impose no requirements for input to be considered - // complete. subclasses should do something more intelligent. + // Impose no requirements for input to be considered complete. subclasses + // should do something more intelligent. return true; } @@ -289,8 +288,8 @@ //------------------------------------------------------------------ // Intercept the IOHandler::Interrupt() calls and do something. // - // Return true if the interrupt was handled, false if the IOHandler - // should continue to try handle the interrupt itself. + // Return true if the interrupt was handled, false if the IOHandler should + // continue to try handle the interrupt itself. //------------------------------------------------------------------ virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; } @@ -302,8 +301,7 @@ // IOHandlerDelegateMultiline // // A IOHandlerDelegate that handles terminating multi-line input when -// the last line is equal to "end_line" which is specified in the -// constructor. +// the last line is equal to "end_line" which is specified in the constructor. //---------------------------------------------------------------------- class IOHandlerDelegateMultiline : public IOHandlerDelegate { public: @@ -325,9 +323,8 @@ // Determine whether the end of input signal has been entered const size_t num_lines = lines.GetSize(); if (num_lines > 0 && lines[num_lines - 1] == m_end_line) { - // Remove the terminal line from "lines" so it doesn't appear in - // the resulting input and return true to indicate we are done - // getting lines + // Remove the terminal line from "lines" so it doesn't appear in the + // resulting input and return true to indicate we are done getting lines lines.PopBack(); return true; } @@ -454,8 +451,7 @@ }; // The order of base classes is important. Look at the constructor of -// IOHandlerConfirm -// to see how. +// IOHandlerConfirm to see how. class IOHandlerConfirm : public IOHandlerDelegate, public IOHandlerEditline { public: IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt, Index: lldb/trunk/include/lldb/Core/MappedHash.h =================================================================== --- lldb/trunk/include/lldb/Core/MappedHash.h +++ lldb/trunk/include/lldb/Core/MappedHash.h @@ -256,13 +256,12 @@ return false; } - // This method must be implemented in any subclasses. - // The KeyType is user specified and must somehow result in a string - // value. For example, the KeyType might be a string offset in a string - // table and subclasses can store their string table as a member of the - // subclass and return a valie "const char *" given a "key". The value - // could also be a C string pointer, in which case just returning "key" - // will suffice. + // This method must be implemented in any subclasses. The KeyType is user + // specified and must somehow result in a string value. For example, the + // KeyType might be a string offset in a string table and subclasses can + // store their string table as a member of the subclass and return a valie + // "const char *" given a "key". The value could also be a C string + // pointer, in which case just returning "key" will suffice. virtual const char *GetStringForKeyType(KeyType key) const = 0; virtual bool ReadHashData(uint32_t hash_data_offset, @@ -270,19 +269,18 @@ // This method must be implemented in any subclasses and it must try to // read one "Pair" at the offset pointed to by the "hash_data_offset_ptr" - // parameter. This offset should be updated as bytes are consumed and - // a value "Result" enum should be returned. If the "name" matches the - // full name for the "pair.key" (which must be filled in by this call), - // then the HashData in the pair ("pair.value") should be extracted and - // filled in and "eResultKeyMatch" should be returned. If "name" doesn't - // match this string for the key, then "eResultKeyMismatch" should be - // returned and all data for the current HashData must be consumed or - // skipped and the "hash_data_offset_ptr" offset needs to be updated to - // point to the next HashData. If the end of the HashData objects for - // a given hash value have been reached, then "eResultEndOfHashData" - // should be returned. If anything else goes wrong during parsing, - // return "eResultError" and the corresponding "Find()" function will - // be canceled and return false. + // parameter. This offset should be updated as bytes are consumed and a + // value "Result" enum should be returned. If the "name" matches the full + // name for the "pair.key" (which must be filled in by this call), then the + // HashData in the pair ("pair.value") should be extracted and filled in + // and "eResultKeyMatch" should be returned. If "name" doesn't match this + // string for the key, then "eResultKeyMismatch" should be returned and all + // data for the current HashData must be consumed or skipped and the + // "hash_data_offset_ptr" offset needs to be updated to point to the next + // HashData. If the end of the HashData objects for a given hash value have + // been reached, then "eResultEndOfHashData" should be returned. If + // anything else goes wrong during parsing, return "eResultError" and the + // corresponding "Find()" function will be canceled and return false. virtual Result GetHashDataForName(llvm::StringRef name, lldb::offset_t *hash_data_offset_ptr, Pair &pair) const = 0; Index: lldb/trunk/include/lldb/Core/Module.h =================================================================== --- lldb/trunk/include/lldb/Core/Module.h +++ lldb/trunk/include/lldb/Core/Module.h @@ -113,13 +113,12 @@ class Module : public std::enable_shared_from_this, public SymbolContextScope { public: - // Static functions that can track the lifetime of module objects. - // This is handy because we might have Module objects that are in - // shared pointers that aren't in the global module list (from - // ModuleList). If this is the case we need to know about it. - // The modules in the global list maintained by these functions - // can be viewed using the "target modules list" command using the - // "--global" (-g for short). + // Static functions that can track the lifetime of module objects. This is + // handy because we might have Module objects that are in shared pointers + // that aren't in the global module list (from ModuleList). If this is the + // case we need to know about it. The modules in the global list maintained + // by these functions can be viewed using the "target modules list" command + // using the "--global" (-g for short). static size_t GetNumberAllocatedModules(); static Module *GetAllocatedModuleAtIndex(size_t idx); @@ -936,12 +935,10 @@ TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language); // Special error functions that can do printf style formatting that will - // prepend the message with - // something appropriate for this module (like the architecture, path and - // object name (if any)). - // This centralizes code so that everyone doesn't need to format their error - // and log messages on - // their own and keeps the output a bit more consistent. + // prepend the message with something appropriate for this module (like the + // architecture, path and object name (if any)). This centralizes code so + // that everyone doesn't need to format their error and log messages on their + // own and keeps the output a bit more consistent. void LogMessage(Log *log, const char *format, ...) __attribute__((format(printf, 3, 4))); @@ -960,15 +957,15 @@ __attribute__((format(printf, 2, 3))); //------------------------------------------------------------------ - // Return true if the file backing this module has changed since the - // module was originally created since we saved the initial file - // modification time when the module first gets created. + // Return true if the file backing this module has changed since the module + // was originally created since we saved the initial file modification time + // when the module first gets created. //------------------------------------------------------------------ bool FileHasChanged() const; //------------------------------------------------------------------ - // SymbolVendor, SymbolFile and ObjectFile member objects should - // lock the module mutex to avoid deadlocks. + // SymbolVendor, SymbolFile and ObjectFile member objects should lock the + // module mutex to avoid deadlocks. //------------------------------------------------------------------ std::recursive_mutex &GetMutex() const { return m_mutex; } Index: lldb/trunk/include/lldb/Core/ModuleList.h =================================================================== --- lldb/trunk/include/lldb/Core/ModuleList.h +++ lldb/trunk/include/lldb/Core/ModuleList.h @@ -410,9 +410,9 @@ //------------------------------------------------------------------ // Find a module by UUID // - // The UUID value for a module is extracted from the ObjectFile and - // is the MD5 checksum, or a smarter object file equivalent, so - // finding modules by UUID values is very efficient and accurate. + // The UUID value for a module is extracted from the ObjectFile and is the + // MD5 checksum, or a smarter object file equivalent, so finding modules by + // UUID values is very efficient and accurate. //------------------------------------------------------------------ lldb::ModuleSP FindModule(const UUID &uuid) const; Index: lldb/trunk/include/lldb/Core/ModuleSpec.h =================================================================== --- lldb/trunk/include/lldb/Core/ModuleSpec.h +++ lldb/trunk/include/lldb/Core/ModuleSpec.h @@ -341,8 +341,8 @@ m_specs.insert(m_specs.end(), rhs.m_specs.begin(), rhs.m_specs.end()); } - // The index "i" must be valid and this can't be used in - // multi-threaded code as no mutex lock is taken. + // The index "i" must be valid and this can't be used in multi-threaded code + // as no mutex lock is taken. ModuleSpec &GetModuleSpecRefAtIndex(size_t i) { return m_specs[i]; } bool GetModuleSpecAtIndex(size_t i, ModuleSpec &module_spec) const { Index: lldb/trunk/include/lldb/Core/PluginManager.h =================================================================== --- lldb/trunk/include/lldb/Core/PluginManager.h +++ lldb/trunk/include/lldb/Core/PluginManager.h @@ -477,11 +477,11 @@ const ConstString &name); //------------------------------------------------------------------ - // Some plug-ins might register a DebuggerInitializeCallback - // callback when registering the plug-in. After a new Debugger - // instance is created, this DebuggerInitialize function will get - // called. This allows plug-ins to install Properties and do any - // other initialization that requires a debugger instance. + // Some plug-ins might register a DebuggerInitializeCallback callback when + // registering the plug-in. After a new Debugger instance is created, this + // DebuggerInitialize function will get called. This allows plug-ins to + // install Properties and do any other initialization that requires a + // debugger instance. //------------------------------------------------------------------ static void DebuggerInitialize(Debugger &debugger); Index: lldb/trunk/include/lldb/Core/RangeMap.h =================================================================== --- lldb/trunk/include/lldb/Core/RangeMap.h +++ lldb/trunk/include/lldb/Core/RangeMap.h @@ -27,9 +27,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -// Templatized classes for dealing with generic ranges and also -// collections of ranges, or collections of ranges that have associated -// data. +// Templatized classes for dealing with generic ranges and also collections of +// ranges, or collections of ranges that have associated data. //---------------------------------------------------------------------- //---------------------------------------------------------------------- @@ -214,8 +213,8 @@ else minimal_ranges.push_back(*pos); } - // Use the swap technique in case our new vector is much smaller. - // We must swap when using the STL because std::vector objects never + // Use the swap technique in case our new vector is much smaller. We + // must swap when using the STL because std::vector objects never // release or reduce the memory once it has been allocated/reserved. m_entries.swap(minimal_ranges); } @@ -228,8 +227,8 @@ #endif if (m_entries.empty()) return fail_value; - // m_entries must be sorted, so if we aren't empty, we grab the - // first range's base + // m_entries must be sorted, so if we aren't empty, we grab the first + // range's base return m_entries.front().GetRangeBase(); } @@ -239,8 +238,8 @@ #endif if (m_entries.empty()) return fail_value; - // m_entries must be sorted, so if we aren't empty, we grab the - // last range's end + // m_entries must be sorted, so if we aren't empty, we grab the last + // range's end return m_entries.back().GetRangeEnd(); } @@ -446,8 +445,8 @@ else minimal_ranges.push_back(*pos); } - // Use the swap technique in case our new vector is much smaller. - // We must swap when using the STL because std::vector objects never + // Use the swap technique in case our new vector is much smaller. We + // must swap when using the STL because std::vector objects never // release or reduce the memory once it has been allocated/reserved. m_entries.swap(minimal_ranges); } @@ -460,8 +459,8 @@ #endif if (m_entries.empty()) return fail_value; - // m_entries must be sorted, so if we aren't empty, we grab the - // first range's base + // m_entries must be sorted, so if we aren't empty, we grab the first + // range's base return m_entries.front().GetRangeBase(); } @@ -471,8 +470,8 @@ #endif if (m_entries.empty()) return fail_value; - // m_entries must be sorted, so if we aren't empty, we grab the - // last range's end + // m_entries must be sorted, so if we aren't empty, we grab the last + // range's end return m_entries.back().GetRangeEnd(); } @@ -604,8 +603,8 @@ //---------------------------------------------------------------------- // A simple range with data class where you get to define the type of -// the range base "B", the type used for the range byte size "S", and -// the type for the associated data "T". +// the range base "B", the type used for the range byte size "S", and the type +// for the associated data "T". //---------------------------------------------------------------------- template struct RangeData : public Range { @@ -688,8 +687,8 @@ } } - // We we can combine at least one entry, then we make a new collection - // and populate it accordingly, and then swap it into place. + // We we can combine at least one entry, then we make a new collection and + // populate it accordingly, and then swap it into place. if (can_combine) { Collection minimal_ranges; for (pos = m_entries.begin(), end = m_entries.end(), prev = end; @@ -699,9 +698,9 @@ else minimal_ranges.push_back(*pos); } - // Use the swap technique in case our new vector is much smaller. - // We must swap when using the STL because std::vector objects never - // release or reduce the memory once it has been allocated/reserved. + // Use the swap technique in case our new vector is much smaller. We must + // swap when using the STL because std::vector objects never release or + // reduce the memory once it has been allocated/reserved. m_entries.swap(minimal_ranges); } } @@ -828,8 +827,8 @@ Collection m_entries; }; -// Same as RangeDataArray, but uses std::vector as to not -// require static storage of N items in the class itself +// Same as RangeDataArray, but uses std::vector as to not require static +// storage of N items in the class itself template class RangeDataVector { public: typedef RangeData Entry; @@ -878,8 +877,8 @@ } } - // We we can combine at least one entry, then we make a new collection - // and populate it accordingly, and then swap it into place. + // We we can combine at least one entry, then we make a new collection and + // populate it accordingly, and then swap it into place. if (can_combine) { Collection minimal_ranges; for (pos = m_entries.begin(), end = m_entries.end(), prev = end; @@ -889,15 +888,15 @@ else minimal_ranges.push_back(*pos); } - // Use the swap technique in case our new vector is much smaller. - // We must swap when using the STL because std::vector objects never - // release or reduce the memory once it has been allocated/reserved. + // Use the swap technique in case our new vector is much smaller. We must + // swap when using the STL because std::vector objects never release or + // reduce the memory once it has been allocated/reserved. m_entries.swap(minimal_ranges); } } - // Calculate the byte size of ranges with zero byte sizes by finding - // the next entry with a base address > the current base address + // Calculate the byte size of ranges with zero byte sizes by finding the next + // entry with a base address > the current base address void CalculateSizesOfZeroByteSizeRanges(S full_size = 0) { #ifdef ASSERT_RANGEMAP_ARE_SORTED assert(IsSorted()); @@ -907,9 +906,9 @@ typename Collection::iterator next; for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos) { if (pos->GetByteSize() == 0) { - // Watch out for multiple entries with same address and make sure - // we find an entry that is greater than the current base address - // before we use that for the size + // Watch out for multiple entries with same address and make sure we + // find an entry that is greater than the current base address before + // we use that for the size auto curr_base = pos->GetRangeBase(); for (next = pos + 1; next != end; ++next) { auto next_base = next->GetRangeBase(); @@ -1060,8 +1059,8 @@ } // This method will return the entry that contains the given address, or the - // entry following that address. If you give it an address of 0 and the first - // entry starts at address 0x100, you will get the entry at 0x100. + // entry following that address. If you give it an address of 0 and the + // first entry starts at address 0x100, you will get the entry at 0x100. // // For most uses, FindEntryThatContains is the correct one to use, this is a // less commonly needed behavior. It was added for core file memory regions, @@ -1102,8 +1101,8 @@ //---------------------------------------------------------------------- // A simple range with data class where you get to define the type of -// the range base "B", the type used for the range byte size "S", and -// the type for the associated data "T". +// the range base "B", the type used for the range byte size "S", and the type +// for the associated data "T". //---------------------------------------------------------------------- template struct AddressData { typedef B BaseType; Index: lldb/trunk/include/lldb/Core/RegisterValue.h =================================================================== --- lldb/trunk/include/lldb/Core/RegisterValue.h +++ lldb/trunk/include/lldb/Core/RegisterValue.h @@ -95,14 +95,13 @@ bool GetData(DataExtractor &data) const; - // Copy the register value from this object into a buffer in "dst" - // and obey the "dst_byte_order" when copying the data. Also watch out - // in case "dst_len" is longer or shorter than the register value - // described by "reg_info" and only copy the least significant bytes - // of the register value, or pad the destination with zeroes if the - // register byte size is shorter that "dst_len" (all while correctly - // abiding the "dst_byte_order"). Returns the number of bytes copied - // into "dst". + // Copy the register value from this object into a buffer in "dst" and obey + // the "dst_byte_order" when copying the data. Also watch out in case + // "dst_len" is longer or shorter than the register value described by + // "reg_info" and only copy the least significant bytes of the register + // value, or pad the destination with zeroes if the register byte size is + // shorter that "dst_len" (all while correctly abiding the "dst_byte_order"). + // Returns the number of bytes copied into "dst". uint32_t GetAsMemoryData(const RegisterInfo *reg_info, void *dst, uint32_t dst_len, lldb::ByteOrder dst_byte_order, Status &error) const; Index: lldb/trunk/include/lldb/Core/STLUtils.h =================================================================== --- lldb/trunk/include/lldb/Core/STLUtils.h +++ lldb/trunk/include/lldb/Core/STLUtils.h @@ -40,8 +40,8 @@ }; //---------------------------------------------------------------------- -// Templated type for finding an entry in a std::map whose value -// is equal to something +// Templated type for finding an entry in a std::map whose value is equal +// to something //---------------------------------------------------------------------- template class ValueEquals { public: Index: lldb/trunk/include/lldb/Core/Scalar.h =================================================================== --- lldb/trunk/include/lldb/Core/Scalar.h +++ lldb/trunk/include/lldb/Core/Scalar.h @@ -36,9 +36,9 @@ //---------------------------------------------------------------------- // A class designed to hold onto values and their corresponding types. -// Operators are defined and Scalar objects will correctly promote -// their types and values before performing these operations. Type -// promotion currently follows the ANSI C type promotion rules. +// Operators are defined and Scalar objects will correctly promote their types +// and values before performing these operations. Type promotion currently +// follows the ANSI C type promotion rules. //---------------------------------------------------------------------- class Scalar { public: @@ -180,10 +180,10 @@ static Scalar::Type GetValueTypeForFloatWithByteSize(size_t byte_size); //---------------------------------------------------------------------- - // All operators can benefits from the implicit conversions that will - // happen automagically by the compiler, so no temporary objects will - // need to be created. As a result, we currently don't need a variety of - // overloaded set value accessors. + // All operators can benefits from the implicit conversions that will happen + // automagically by the compiler, so no temporary objects will need to be + // created. As a result, we currently don't need a variety of overloaded set + // value accessors. //---------------------------------------------------------------------- Scalar &operator=(const int i); Scalar &operator=(unsigned int v); @@ -202,27 +202,27 @@ Scalar &operator&=(const Scalar &rhs); //---------------------------------------------------------------------- - // Shifts the current value to the right without maintaining the current - // sign of the value (if it is signed). + // Shifts the current value to the right without maintaining the current sign + // of the value (if it is signed). //---------------------------------------------------------------------- bool ShiftRightLogical(const Scalar &rhs); // Returns true on success //---------------------------------------------------------------------- - // Takes the absolute value of the current value if it is signed, else - // the value remains unchanged. - // Returns false if the contained value has a void type. + // Takes the absolute value of the current value if it is signed, else the + // value remains unchanged. Returns false if the contained value has a void + // type. //---------------------------------------------------------------------- bool AbsoluteValue(); // Returns true on success //---------------------------------------------------------------------- - // Negates the current value (even for unsigned values). - // Returns false if the contained value has a void type. + // Negates the current value (even for unsigned values). Returns false if the + // contained value has a void type. //---------------------------------------------------------------------- bool UnaryNegate(); // Returns true on success //---------------------------------------------------------------------- - // Inverts all bits in the current value as long as it isn't void or - // a float/double/long double type. - // Returns false if the contained value has a void/float/double/long - // double type, else the value is inverted and true is returned. + // Inverts all bits in the current value as long as it isn't void or a + // float/double/long double type. Returns false if the contained value has a + // void/float/double/long double type, else the value is inverted and true is + // returned. //---------------------------------------------------------------------- bool OnesComplement(); // Returns true on success @@ -232,9 +232,9 @@ Scalar::Type GetType() const { return m_type; } //---------------------------------------------------------------------- - // Returns a casted value of the current contained data without - // modifying the current value. FAIL_VALUE will be returned if the type - // of the value is void or invalid. + // Returns a casted value of the current contained data without modifying the + // current value. FAIL_VALUE will be returned if the type of the value is + // void or invalid. //---------------------------------------------------------------------- int SInt(int fail_value = 0) const; @@ -342,8 +342,8 @@ }; //---------------------------------------------------------------------- -// Split out the operators into a format where the compiler will be able -// to implicitly convert numbers into Scalar objects. +// Split out the operators into a format where the compiler will be able to +// implicitly convert numbers into Scalar objects. // // This allows code like: // Scalar two(2); Index: lldb/trunk/include/lldb/Core/SearchFilter.h =================================================================== --- lldb/trunk/include/lldb/Core/SearchFilter.h +++ lldb/trunk/include/lldb/Core/SearchFilter.h @@ -303,8 +303,7 @@ OptionNames name, FileSpecList &file_list); // These are utility functions to assist with the search iteration. They are - // used by the - // default Search method. + // used by the default Search method. Searcher::CallbackReturn DoModuleIteration(const SymbolContext &context, Searcher &searcher); Index: lldb/trunk/include/lldb/Core/Section.h =================================================================== --- lldb/trunk/include/lldb/Core/Section.h +++ lldb/trunk/include/lldb/Core/Section.h @@ -272,10 +272,9 @@ SectionList m_children; // Child sections bool m_fake : 1, // If true, then this section only can contain the address if // one of its - // children contains an address. This allows for gaps between the children - // that are contained in the address range for this section, but do not - // produce - // hits unless the children contain the address. + // children contains an address. This allows for gaps between the + // children that are contained in the address range for this section, but + // do not produce hits unless the children contain the address. m_encrypted : 1, // Set to true if the contents are encrypted m_thread_specific : 1, // This section is thread specific m_readable : 1, // If this section has read permissions Index: lldb/trunk/include/lldb/Core/SourceManager.h =================================================================== --- lldb/trunk/include/lldb/Core/SourceManager.h +++ lldb/trunk/include/lldb/Core/SourceManager.h @@ -106,9 +106,8 @@ #ifndef SWIG // The SourceFileCache class separates the source manager from the cache of - // source files, so the - // cache can be stored in the Debugger, but the source managers can be per - // target. + // source files, so the cache can be stored in the Debugger, but the source + // managers can be per target. class SourceFileCache { public: SourceFileCache() = default; Index: lldb/trunk/include/lldb/Core/StreamBuffer.h =================================================================== --- lldb/trunk/include/lldb/Core/StreamBuffer.h +++ lldb/trunk/include/lldb/Core/StreamBuffer.h @@ -39,9 +39,8 @@ void Clear() { m_packet.clear(); } // Beware, this might not be NULL terminated as you can expect from - // StringString as there may be random bits in the llvm::SmallVector. If - // you are using this class to create a C string, be sure the call PutChar - // ('\0') + // StringString as there may be random bits in the llvm::SmallVector. If you + // are using this class to create a C string, be sure the call PutChar ('\0') // after you have created your string, or use StreamString. const char *GetData() const { return m_packet.data(); } Index: lldb/trunk/include/lldb/Core/UniqueCStringMap.h =================================================================== --- lldb/trunk/include/lldb/Core/UniqueCStringMap.h +++ lldb/trunk/include/lldb/Core/UniqueCStringMap.h @@ -25,11 +25,10 @@ //---------------------------------------------------------------------- // Templatized uniqued string map. // -// This map is useful for mapping unique C string names to values of -// type T. Each "const char *" name added must be unique for a given +// This map is useful for mapping unique C string names to values of type T. +// Each "const char *" name added must be unique for a given // C string value. ConstString::GetCString() can provide such strings. -// Any other string table that has guaranteed unique values can also -// be used. +// Any other string table that has guaranteed unique values can also be used. //---------------------------------------------------------------------- template class UniqueCStringMap { public: @@ -51,9 +50,9 @@ }; //------------------------------------------------------------------ - // Call this function multiple times to add a bunch of entries to - // this map, then later call UniqueCStringMap::Sort() before doing - // any searches by name. + // Call this function multiple times to add a bunch of entries to this map, + // then later call UniqueCStringMap::Sort() before doing any searches by + // name. //------------------------------------------------------------------ void Append(ConstString unique_cstr, const T &value) { m_map.push_back(typename UniqueCStringMap::Entry(unique_cstr, value)); @@ -64,8 +63,8 @@ void Clear() { m_map.clear(); } //------------------------------------------------------------------ - // Call this function to always keep the map sorted when putting - // entries into the map. + // Call this function to always keep the map sorted when putting entries into + // the map. //------------------------------------------------------------------ void Insert(ConstString unique_cstr, const T &value) { typename UniqueCStringMap::Entry e(unique_cstr, value); @@ -79,8 +78,8 @@ //------------------------------------------------------------------ // Get an entries by index in a variety of forms. // - // The caller is responsible for ensuring that the collection does - // not change during while using the returned values. + // The caller is responsible for ensuring that the collection does not change + // during while using the returned values. //------------------------------------------------------------------ bool GetValueAtIndex(uint32_t idx, T &value) const { if (idx < m_map.size()) { @@ -94,12 +93,12 @@ return m_map[idx].cstring; } - // Use this function if you have simple types in your map that you - // can easily copy when accessing values by index. + // Use this function if you have simple types in your map that you can easily + // copy when accessing values by index. T GetValueAtIndexUnchecked(uint32_t idx) const { return m_map[idx].value; } - // Use this function if you have complex types in your map that you - // don't want to copy when accessing values by index. + // Use this function if you have complex types in your map that you don't + // want to copy when accessing values by index. const T &GetValueRefAtIndexUnchecked(uint32_t idx) const { return m_map[idx].value; } @@ -111,8 +110,8 @@ //------------------------------------------------------------------ // Find the value for the unique string in the map. // - // Return the value for \a unique_cstr if one is found, return - // \a fail_value otherwise. This method works well for simple type + // Return the value for \a unique_cstr if one is found, return \a fail_value + // otherwise. This method works well for simple type // T values and only if there is a sensible failure value that can // be returned and that won't match any existing values. //------------------------------------------------------------------ @@ -128,11 +127,11 @@ } //------------------------------------------------------------------ - // Get a pointer to the first entry that matches "name". nullptr will - // be returned if there is no entry that matches "name". + // Get a pointer to the first entry that matches "name". nullptr will be + // returned if there is no entry that matches "name". // - // The caller is responsible for ensuring that the collection does - // not change during while using the returned pointer. + // The caller is responsible for ensuring that the collection does not change + // during while using the returned pointer. //------------------------------------------------------------------ const Entry *FindFirstValueForName(ConstString unique_cstr) const { Entry search_entry(unique_cstr); @@ -144,12 +143,12 @@ } //------------------------------------------------------------------ - // Get a pointer to the next entry that matches "name" from a - // previously returned Entry pointer. nullptr will be returned if there - // is no subsequent entry that matches "name". + // Get a pointer to the next entry that matches "name" from a previously + // returned Entry pointer. nullptr will be returned if there is no subsequent + // entry that matches "name". // - // The caller is responsible for ensuring that the collection does - // not change during while using the returned pointer. + // The caller is responsible for ensuring that the collection does not change + // during while using the returned pointer. //------------------------------------------------------------------ const Entry *FindNextValueForName(const Entry *entry_ptr) const { if (!m_map.empty()) { @@ -204,16 +203,15 @@ bool IsEmpty() const { return m_map.empty(); } //------------------------------------------------------------------ - // Reserve memory for at least "n" entries in the map. This is - // useful to call when you know you will be adding a lot of entries - // using UniqueCStringMap::Append() (which should be followed by a - // call to UniqueCStringMap::Sort()) or to UniqueCStringMap::Insert(). + // Reserve memory for at least "n" entries in the map. This is useful to call + // when you know you will be adding a lot of entries using + // UniqueCStringMap::Append() (which should be followed by a call to + // UniqueCStringMap::Sort()) or to UniqueCStringMap::Insert(). //------------------------------------------------------------------ void Reserve(size_t n) { m_map.reserve(n); } //------------------------------------------------------------------ - // Sort the unsorted contents in this map. A typical code flow would - // be: + // Sort the unsorted contents in this map. A typical code flow would be: // size_t approximate_num_entries = .... // UniqueCStringMap my_map; // my_map.Reserve (approximate_num_entries); @@ -226,12 +224,11 @@ void Sort() { std::sort(m_map.begin(), m_map.end()); } //------------------------------------------------------------------ - // Since we are using a vector to contain our items it will always - // double its memory consumption as things are added to the vector, - // so if you intend to keep a UniqueCStringMap around and have - // a lot of entries in the map, you will want to call this function - // to create a new vector and copy _only_ the exact size needed as - // part of the finalization of the string map. + // Since we are using a vector to contain our items it will always double its + // memory consumption as things are added to the vector, so if you intend to + // keep a UniqueCStringMap around and have a lot of entries in the map, you + // will want to call this function to create a new vector and copy _only_ the + // exact size needed as part of the finalization of the string map. //------------------------------------------------------------------ void SizeToFit() { if (m_map.size() < m_map.capacity()) { Index: lldb/trunk/include/lldb/Core/UserSettingsController.h =================================================================== --- lldb/trunk/include/lldb/Core/UserSettingsController.h +++ lldb/trunk/include/lldb/Core/UserSettingsController.h @@ -49,8 +49,8 @@ virtual ~Properties() {} virtual lldb::OptionValuePropertiesSP GetValueProperties() const { - // This function is virtual in case subclasses want to lazily - // implement creating the properties. + // This function is virtual in case subclasses want to lazily implement + // creating the properties. return m_collection_sp; } @@ -82,16 +82,11 @@ // We sometimes need to introduce a setting to enable experimental features, // but then we don't want the setting for these to cause errors when the - // setting - // goes away. Add a sub-topic of the settings using this experimental name, - // and - // two things will happen. One is that settings that don't find the name will - // not - // be treated as errors. Also, if you decide to keep the settings just move - // them into - // the containing properties, and we will auto-forward the experimental - // settings to the - // real one. + // setting goes away. Add a sub-topic of the settings using this + // experimental name, and two things will happen. One is that settings that + // don't find the name will not be treated as errors. Also, if you decide to + // keep the settings just move them into the containing properties, and we + // will auto-forward the experimental settings to the real one. static const char *GetExperimentalSettingsName(); static bool IsSettingExperimental(llvm::StringRef setting); Index: lldb/trunk/include/lldb/Core/Value.h =================================================================== --- lldb/trunk/include/lldb/Core/Value.h +++ lldb/trunk/include/lldb/Core/Value.h @@ -48,8 +48,8 @@ class Value { public: - // Values Less than zero are an error, greater than or equal to zero - // returns what the Scalar result is. + // Values Less than zero are an error, greater than or equal to zero returns + // what the Scalar result is. enum ValueType { // m_value contains... // ============================ @@ -107,8 +107,7 @@ byte_order != lldb::eByteOrderInvalid); } // Casts a vector, if valid, to an unsigned int of matching or largest - // supported size. - // Truncates to the beginning of the vector if required. + // supported size. Truncates to the beginning of the vector if required. // Returns a default constructed Scalar if the Vector data is internally // inconsistent. llvm::APInt rhs = llvm::APInt(BITWIDTH_INT128, NUM_OF_WORDS_INT128, Index: lldb/trunk/include/lldb/Core/ValueObject.h =================================================================== --- lldb/trunk/include/lldb/Core/ValueObject.h +++ lldb/trunk/include/lldb/Core/ValueObject.h @@ -286,10 +286,10 @@ return m_exe_ctx_ref; } - // Set the EvaluationPoint to the values in exe_scope, - // Return true if the Evaluation Point changed. - // Since the ExecutionContextScope is always going to be valid currently, - // the Updated Context will also always be valid. + // Set the EvaluationPoint to the values in exe_scope, Return true if the + // Evaluation Point changed. Since the ExecutionContextScope is always + // going to be valid currently, the Updated Context will also always be + // valid. // bool // SetContext (ExecutionContextScope *exe_scope); @@ -327,8 +327,7 @@ void SetInvalid() { // Use the stop id to mark us as invalid, leave the thread id and the - // stack id around for logging and - // history purposes. + // stack id around for logging and history purposes. m_mod_id.SetInvalid(); // Can't update an invalid state. @@ -464,17 +463,16 @@ virtual bool SetValueFromCString(const char *value_str, Status &error); - // Return the module associated with this value object in case the - // value is from an executable file and might have its data in - // sections of the file. This can be used for variables. + // Return the module associated with this value object in case the value is + // from an executable file and might have its data in sections of the file. + // This can be used for variables. virtual lldb::ModuleSP GetModule(); ValueObject *GetRoot(); // Given a ValueObject, loop over itself and its parent, and its parent's - // parent, .. - // until either the given callback returns false, or you end up at a null - // pointer + // parent, .. until either the given callback returns false, or you end up at + // a null pointer ValueObject *FollowParentChain(std::function); virtual bool GetDeclaration(Declaration &decl); @@ -517,9 +515,9 @@ virtual bool ResolveValue(Scalar &scalar); - // return 'false' whenever you set the error, otherwise - // callers may assume true means everything is OK - this will - // break breakpoint conditions among potentially a few others + // return 'false' whenever you set the error, otherwise callers may assume + // true means everything is OK - this will break breakpoint conditions among + // potentially a few others virtual bool IsLogicalTrue(Status &error); virtual const char *GetLocationAsCString(); @@ -646,8 +644,8 @@ virtual lldb::ValueObjectSP CastPointerType(const char *name, lldb::TypeSP &type_sp); - // The backing bits of this value object were updated, clear any - // descriptive string, so we know we have to refetch them + // The backing bits of this value object were updated, clear any descriptive + // string, so we know we have to refetch them virtual void ValueUpdated() { ClearUserVisibleData(eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary | @@ -694,9 +692,8 @@ lldb::ValueObjectSP Persist(); - // returns true if this is a char* or a char[] - // if it is a char* and check_pointer is true, - // it also checks that the pointer is valid + // returns true if this is a char* or a char[] if it is a char* and + // check_pointer is true, it also checks that the pointer is valid bool IsCStringContainer(bool check_pointer = false); std::pair @@ -776,11 +773,9 @@ } // Use GetParent for display purposes, but if you want to tell the parent to - // update itself - // then use m_parent. The ValueObjectDynamicValue's parent is not the correct - // parent for - // displaying, they are really siblings, so for display it needs to route - // through to its grandparent. + // update itself then use m_parent. The ValueObjectDynamicValue's parent is + // not the correct parent for displaying, they are really siblings, so for + // display it needs to route through to its grandparent. virtual ValueObject *GetParent() { return m_parent; } virtual const ValueObject *GetParent() const { return m_parent; } @@ -904,9 +899,9 @@ ValueObjectManager *m_manager; // This object is managed by the root object // (any ValueObject that gets created // without a parent.) The manager gets passed through all the generations of - // dependent objects, and will keep the whole cluster of objects alive as long - // as a shared pointer to any of them has been handed out. Shared pointers to - // value objects must always be made with the GetSP method. + // dependent objects, and will keep the whole cluster of objects alive as + // long as a shared pointer to any of them has been handed out. Shared + // pointers to value objects must always be made with the GetSP method. ChildrenManager m_children; std::map m_synthetic_children; @@ -954,21 +949,19 @@ // Constructors and Destructors //------------------------------------------------------------------ - // Use the no-argument constructor to make a constant variable object (with no - // ExecutionContextScope.) + // Use the no-argument constructor to make a constant variable object (with + // no ExecutionContextScope.) ValueObject(); // Use this constructor to create a "root variable object". The ValueObject - // will be locked to this context - // through-out its lifespan. + // will be locked to this context through-out its lifespan. ValueObject(ExecutionContextScope *exe_scope, AddressType child_ptr_or_ref_addr_type = eAddressTypeLoad); // Use this constructor to create a ValueObject owned by another ValueObject. - // It will inherit the ExecutionContext - // of its parent. + // It will inherit the ExecutionContext of its parent. ValueObject(ValueObject &parent); @@ -990,8 +983,8 @@ virtual void CalculateSyntheticValue(bool use_synthetic = true); - // Should only be called by ValueObject::GetChildAtIndex() - // Returns a ValueObject managed by this ValueObject's manager. + // Should only be called by ValueObject::GetChildAtIndex() Returns a + // ValueObject managed by this ValueObject's manager. virtual ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index); @@ -1043,8 +1036,9 @@ //------------------------------------------------------------------------------ // A value object manager class that is seeded with the static variable value // and it vends the user facing value object. If the type is dynamic it can -// vend the dynamic type. If this user type also has a synthetic type associated -// with it, it will vend the synthetic type. The class watches the process' stop +// vend the dynamic type. If this user type also has a synthetic type +// associated with it, it will vend the synthetic type. The class watches the +// process' stop // ID and will update the user type when needed. //------------------------------------------------------------------------------ class ValueObjectManager { Index: lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h =================================================================== --- lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h +++ lldb/trunk/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -39,9 +39,9 @@ //---------------------------------------------------------------------- // A ValueObject that obtains its children from some source other than // real information -// This is currently used to implement Python-based children and filters -// but you can bind it to any source of synthetic information and have -// it behave accordingly +// This is currently used to implement Python-based children and filters but +// you can bind it to any source of synthetic information and have it behave +// accordingly //---------------------------------------------------------------------- class ValueObjectSynthetic : public ValueObject { public: Index: lldb/trunk/include/lldb/DataFormatters/DataVisualization.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/DataVisualization.h +++ lldb/trunk/include/lldb/DataFormatters/DataVisualization.h @@ -21,15 +21,14 @@ namespace lldb_private { -// this class is the high-level front-end of LLDB Data Visualization -// code in FormatManager.h/cpp is the low-level implementation of this feature -// clients should refer to this class as the entry-point into the data -// formatters +// this class is the high-level front-end of LLDB Data Visualization code in +// FormatManager.h/cpp is the low-level implementation of this feature clients +// should refer to this class as the entry-point into the data formatters // unless they have a good reason to bypass this and go to the backend class DataVisualization { public: - // use this call to force the FM to consider itself updated even when there is - // no apparent reason for that + // use this call to force the FM to consider itself updated even when there + // is no apparent reason for that static void ForceUpdate(); static uint32_t GetCurrentRevision(); Index: lldb/trunk/include/lldb/DataFormatters/FormatClasses.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/FormatClasses.h +++ lldb/trunk/include/lldb/DataFormatters/FormatClasses.h @@ -160,8 +160,8 @@ private: bool m_is_regex; - // this works better than TypeAndOrName because the latter only wraps a TypeSP - // whereas TypePair can also be backed by a CompilerType + // this works better than TypeAndOrName because the latter only wraps a + // TypeSP whereas TypePair can also be backed by a CompilerType struct TypeOrName { std::string m_type_name; TypePair m_type_pair; Index: lldb/trunk/include/lldb/DataFormatters/FormatManager.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/FormatManager.h +++ lldb/trunk/include/lldb/DataFormatters/FormatManager.h @@ -33,12 +33,10 @@ namespace lldb_private { // this file (and its. cpp) contain the low-level implementation of LLDB Data -// Visualization -// class DataVisualization is the high-level front-end of this feature -// clients should refer to that class as the entry-point into the data -// formatters -// unless they have a good reason to bypass it and prefer to use this file's -// objects directly +// Visualization class DataVisualization is the high-level front-end of this +// feature clients should refer to that class as the entry-point into the data +// formatters unless they have a good reason to bypass it and prefer to use +// this file's objects directly class FormatManager : public IFormatChangeListener { typedef FormatMap NamedSummariesMap; @@ -175,24 +173,22 @@ static const char *GetFormatAsCString(lldb::Format format); - // if the user tries to add formatters for, say, "struct Foo" - // those will not match any type because of the way we strip qualifiers from - // typenames - // this method looks for the case where the user is adding a - // "class","struct","enum" or "union" Foo - // and strips the unnecessary qualifier + // if the user tries to add formatters for, say, "struct Foo" those will not + // match any type because of the way we strip qualifiers from typenames this + // method looks for the case where the user is adding a + // "class","struct","enum" or "union" Foo and strips the unnecessary + // qualifier static ConstString GetValidTypeName(const ConstString &type); // when DataExtractor dumps a vectorOfT, it uses a predefined format for each - // item - // this method returns it, or eFormatInvalid if vector_format is not a + // item this method returns it, or eFormatInvalid if vector_format is not a // vectorOf static lldb::Format GetSingleItemFormat(lldb::Format vector_format); - // this returns true if the ValueObjectPrinter is *highly encouraged* - // to actually represent this ValueObject in one-liner format - // If this object has a summary formatter, however, we should not - // try and do one-lining, just let the summary do the right thing + // this returns true if the ValueObjectPrinter is *highly encouraged* to + // actually represent this ValueObject in one-liner format If this object has + // a summary formatter, however, we should not try and do one-lining, just + // let the summary do the right thing bool ShouldPrintAsOneLiner(ValueObject &valobj); void Changed() override; @@ -249,15 +245,12 @@ TypeCategoryMap &GetCategories() { return m_categories_map; } - // These functions are meant to initialize formatters that are very - // low-level/global in nature - // and do not naturally belong in any language. The intent is that most - // formatters go in - // language-specific categories. Eventually, the runtimes should also be - // allowed to vend their - // own formatters, and then one could put formatters that depend on specific - // library load events - // in the language runtimes, on an as-needed basis + // These functions are meant to initialize formatters that are very low- + // level/global in nature and do not naturally belong in any language. The + // intent is that most formatters go in language-specific categories. + // Eventually, the runtimes should also be allowed to vend their own + // formatters, and then one could put formatters that depend on specific + // library load events in the language runtimes, on an as-needed basis void LoadSystemFormatters(); void LoadVectorFormatters(); Index: lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h +++ lldb/trunk/include/lldb/DataFormatters/FormattersContainer.h @@ -43,12 +43,10 @@ virtual uint32_t GetCurrentRevision() = 0; }; -// if the user tries to add formatters for, say, "struct Foo" -// those will not match any type because of the way we strip qualifiers from -// typenames -// this method looks for the case where the user is adding a -// "class","struct","enum" or "union" Foo -// and strips the unnecessary qualifier +// if the user tries to add formatters for, say, "struct Foo" those will not +// match any type because of the way we strip qualifiers from typenames this +// method looks for the case where the user is adding a "class","struct","enum" +// or "union" Foo and strips the unnecessary qualifier static inline ConstString GetValidTypeName_Impl(const ConstString &type) { if (type.IsEmpty()) return type; Index: lldb/trunk/include/lldb/DataFormatters/StringPrinter.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/StringPrinter.h +++ lldb/trunk/include/lldb/DataFormatters/StringPrinter.h @@ -266,8 +266,7 @@ // I can't use a std::unique_ptr for this because the Deleter is a template // argument there // and I want the same type to represent both pointers I want to free and - // pointers I don't need - // to free - which is what this class essentially is + // pointers I don't need to free - which is what this class essentially is // It's very specialized to the needs of this file, and not suggested for // general use template Index: lldb/trunk/include/lldb/DataFormatters/TypeFormat.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/TypeFormat.h +++ lldb/trunk/include/lldb/DataFormatters/TypeFormat.h @@ -146,10 +146,9 @@ virtual Type GetType() { return Type::eTypeUnknown; } // we are using a ValueObject* instead of a ValueObjectSP because we do not - // need to hold on to this for - // extended periods of time and we trust the ValueObject to stay around for as - // long as it is required - // for us to generate its value + // need to hold on to this for extended periods of time and we trust the + // ValueObject to stay around for as long as it is required for us to + // generate its value virtual bool FormatObject(ValueObject *valobj, std::string &dest) const = 0; virtual std::string GetDescription() = 0; Index: lldb/trunk/include/lldb/DataFormatters/TypeSummary.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/TypeSummary.h +++ lldb/trunk/include/lldb/DataFormatters/TypeSummary.h @@ -258,10 +258,9 @@ void SetOptions(uint32_t value) { m_flags.SetValue(value); } // we are using a ValueObject* instead of a ValueObjectSP because we do not - // need to hold on to this for - // extended periods of time and we trust the ValueObject to stay around for as - // long as it is required - // for us to generate its summary + // need to hold on to this for extended periods of time and we trust the + // ValueObject to stay around for as long as it is required for us to + // generate its summary virtual bool FormatObject(ValueObject *valobj, std::string &dest, const TypeSummaryOptions &options) = 0; @@ -311,8 +310,8 @@ // summaries implemented via a C++ function struct CXXFunctionSummaryFormat : public TypeSummaryImpl { - // we should convert these to SBValue and SBStream if we ever cross - // the boundary towards the external world + // we should convert these to SBValue and SBStream if we ever cross the + // boundary towards the external world typedef std::function Callback; Index: lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h +++ lldb/trunk/include/lldb/DataFormatters/TypeSynthetic.h @@ -55,34 +55,29 @@ virtual size_t GetIndexOfChildWithName(const ConstString &name) = 0; // this function is assumed to always succeed and it if fails, the front-end - // should know to deal - // with it in the correct way (most probably, by refusing to return any - // children) - // the return value of Update() should actually be interpreted as - // "ValueObjectSyntheticFilter cache is good/bad" - // if =true, ValueObjectSyntheticFilter is allowed to use the children it - // fetched previously and cached - // if =false, ValueObjectSyntheticFilter must throw away its cache, and query - // again for children + // should know to deal with it in the correct way (most probably, by refusing + // to return any children) the return value of Update() should actually be + // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true, + // ValueObjectSyntheticFilter is allowed to use the children it fetched + // previously and cached if =false, ValueObjectSyntheticFilter must throw + // away its cache, and query again for children virtual bool Update() = 0; // if this function returns false, then CalculateNumChildren() MUST return 0 - // since UI frontends - // might validly decide not to inquire for children given a false return value - // from this call - // if it returns true, then CalculateNumChildren() can return any number >= 0 - // (0 being valid) - // it should if at all possible be more efficient than CalculateNumChildren() + // since UI frontends might validly decide not to inquire for children given + // a false return value from this call if it returns true, then + // CalculateNumChildren() can return any number >= 0 (0 being valid) it + // should if at all possible be more efficient than CalculateNumChildren() virtual bool MightHaveChildren() = 0; // if this function returns a non-null ValueObject, then the returned - // ValueObject will stand - // for this ValueObject whenever a "value" request is made to this ValueObject + // ValueObject will stand for this ValueObject whenever a "value" request is + // made to this ValueObject virtual lldb::ValueObjectSP GetSyntheticValue() { return nullptr; } - // if this function returns a non-empty ConstString, then clients are expected - // to use the return - // as the name of the type of this ValueObject for display purposes + // if this function returns a non-empty ConstString, then clients are + // expected to use the return as the name of the type of this ValueObject for + // display purposes virtual ConstString GetSyntheticTypeName() { return ConstString(); } typedef std::shared_ptr SharedPointer; Index: lldb/trunk/include/lldb/DataFormatters/TypeValidator.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/TypeValidator.h +++ lldb/trunk/include/lldb/DataFormatters/TypeValidator.h @@ -147,10 +147,9 @@ virtual Type GetType() { return Type::eTypeUnknown; } // we are using a ValueObject* instead of a ValueObjectSP because we do not - // need to hold on to this for - // extended periods of time and we trust the ValueObject to stay around for as - // long as it is required - // for us to generate its value + // need to hold on to this for extended periods of time and we trust the + // ValueObject to stay around for as long as it is required for us to + // generate its value virtual ValidationResult FormatObject(ValueObject *valobj) const = 0; virtual std::string GetDescription() = 0; Index: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h =================================================================== --- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h +++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -47,16 +47,16 @@ InstancePointersSetSP m_printed_instance_pointers; - // only this class (and subclasses, if any) should ever be concerned with - // the depth mechanism + // only this class (and subclasses, if any) should ever be concerned with the + // depth mechanism ValueObjectPrinter(ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth, InstancePointersSetSP printed_instance_pointers); - // we should actually be using delegating constructors here - // but some versions of GCC still have trouble with those + // we should actually be using delegating constructors here but some versions + // of GCC still have trouble with those void Init(ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options, const DumpValueObjectOptions::PointerDepth &ptr_depth, Index: lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h =================================================================== --- lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h +++ lldb/trunk/include/lldb/Expression/ExpressionSourceCode.h @@ -40,9 +40,8 @@ bool static_method, ExecutionContext &exe_ctx) const; // Given a string returned by GetText, find the beginning and end of the body - // passed to CreateWrapped. - // Return true if the bounds could be found. This will also work on text with - // FixItHints applied. + // passed to CreateWrapped. Return true if the bounds could be found. This + // will also work on text with FixItHints applied. static bool GetOriginalBodyBounds(std::string transformed_text, lldb::LanguageType wrapping_language, size_t &start_loc, size_t &end_loc); Index: lldb/trunk/include/lldb/Expression/ExpressionVariable.h =================================================================== --- lldb/trunk/include/lldb/Expression/ExpressionVariable.h +++ lldb/trunk/include/lldb/Expression/ExpressionVariable.h @@ -69,15 +69,12 @@ void SetName(const ConstString &name) { m_frozen_sp->SetName(name); } // this function is used to copy the address-of m_live_sp into m_frozen_sp - // this is necessary because the results of certain cast and - // pointer-arithmetic - // operations (such as those described in bugzilla issues 11588 and 11618) - // generate - // frozen objects that do not have a valid address-of, which can be - // troublesome when - // using synthetic children providers. Transferring the address-of the live - // object - // solves these issues and provides the expected user-level behavior + // this is necessary because the results of certain cast and pointer- + // arithmetic operations (such as those described in bugzilla issues 11588 + // and 11618) generate frozen objects that do not have a valid address-of, + // which can be troublesome when using synthetic children providers. + // Transferring the address-of the live object solves these issues and + // provides the expected user-level behavior void TransferAddress(bool force = false) { if (m_live_sp.get() == nullptr) return; Index: lldb/trunk/include/lldb/Expression/IRMemoryMap.h =================================================================== --- lldb/trunk/include/lldb/Expression/IRMemoryMap.h +++ lldb/trunk/include/lldb/Expression/IRMemoryMap.h @@ -83,8 +83,8 @@ lldb::TargetSP GetTarget() { return m_target_wp.lock(); } protected: - // This function should only be used if you know you are using the JIT. - // Any other cases should use GetBestExecutionContextScope(). + // This function should only be used if you know you are using the JIT. Any + // other cases should use GetBestExecutionContextScope(). lldb::ProcessWP &GetProcessWP() { return m_process_wp; } Index: lldb/trunk/include/lldb/Expression/LLVMUserExpression.h =================================================================== --- lldb/trunk/include/lldb/Expression/LLVMUserExpression.h +++ lldb/trunk/include/lldb/Expression/LLVMUserExpression.h @@ -39,12 +39,11 @@ class LLVMUserExpression : public UserExpression { public: // The IRPasses struct is filled in by a runtime after an expression is - // compiled and can be used to to run - // fixups/analysis passes as required. EarlyPasses are run on the generated - // module before lldb runs its own IR + // compiled and can be used to to run fixups/analysis passes as required. + // EarlyPasses are run on the generated module before lldb runs its own IR // fixups and inserts instrumentation code/pointer checks. LatePasses are run - // after the module has been processed by - // llvm, before the module is assembled and run in the ThreadPlan. + // after the module has been processed by llvm, before the module is + // assembled and run in the ThreadPlan. struct IRPasses { IRPasses() : EarlyPasses(nullptr), LatePasses(nullptr){}; std::shared_ptr EarlyPasses; Index: lldb/trunk/include/lldb/Expression/UtilityFunction.h =================================================================== --- lldb/trunk/include/lldb/Expression/UtilityFunction.h +++ lldb/trunk/include/lldb/Expression/UtilityFunction.h @@ -80,8 +80,8 @@ /// false if not (or the function is not JIT compiled) //------------------------------------------------------------------ bool ContainsAddress(lldb::addr_t address) { - // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, - // so this always returns false if the function is not JIT compiled yet + // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, so + // this always returns false if the function is not JIT compiled yet return (address >= m_jit_start_addr && address < m_jit_end_addr); } @@ -116,10 +116,9 @@ //------------------------------------------------------------------ bool NeedsVariableResolution() override { return false; } - // This makes the function caller function. - // Pass in the ThreadSP if you have one available, compilation can end up - // calling code (e.g. to look up indirect - // functions) and we don't want this to wander onto another thread. + // This makes the function caller function. Pass in the ThreadSP if you have + // one available, compilation can end up calling code (e.g. to look up + // indirect functions) and we don't want this to wander onto another thread. FunctionCaller *MakeFunctionCaller(const CompilerType &return_type, const ValueList &arg_value_list, lldb::ThreadSP compilation_thread, Index: lldb/trunk/include/lldb/Host/Debug.h =================================================================== --- lldb/trunk/include/lldb/Host/Debug.h +++ lldb/trunk/include/lldb/Host/Debug.h @@ -25,7 +25,8 @@ //------------------------------------------------------------------ struct ResumeAction { lldb::tid_t tid; // The thread ID that this action applies to, - // LLDB_INVALID_THREAD_ID for the default thread action + // LLDB_INVALID_THREAD_ID for the default thread + // action lldb::StateType state; // Valid values are eStateStopped/eStateSuspended, // eStateRunning, and eStateStepping. int signal; // When resuming this thread, resume it with this signal if this @@ -34,10 +35,9 @@ //------------------------------------------------------------------ // A class that contains instructions for all threads for -// NativeProcessProtocol::Resume(). Each thread can either run, stay -// suspended, or step when the process is resumed. We optionally -// have the ability to also send a signal to the thread when the -// action is run or step. +// NativeProcessProtocol::Resume(). Each thread can either run, stay suspended, +// or step when the process is resumed. We optionally have the ability to also +// send a signal to the thread when the action is run or step. //------------------------------------------------------------------ class ResumeActionList { public: Index: lldb/trunk/include/lldb/Host/Editline.h =================================================================== --- lldb/trunk/include/lldb/Host/Editline.h +++ lldb/trunk/include/lldb/Host/Editline.h @@ -23,8 +23,8 @@ // broken, which is why we're // working around it here. // c) When resizing the terminal window, if the cursor moves between rows -// libedit will get confused. -// d) The incremental search uses escape to cancel input, so it's confused by +// libedit will get confused. d) The incremental search uses escape to cancel +// input, so it's confused by // ANSI sequences starting with escape. // e) Emoji support is fairly terrible, presumably it doesn't understand // composed characters? @@ -38,11 +38,10 @@ #include // components needed to handle wide characters ( , codecvt_utf8, -// libedit built with '--enable-widec' ) -// are available on some platforms. The wchar_t versions of libedit functions -// will only be -// used in cases where this is true. This is a compile time dependecy, for now -// selected per target Platform +// libedit built with '--enable-widec' ) are available on some platforms. The +// wchar_t versions of libedit functions will only be used in cases where this +// is true. This is a compile time dependecy, for now selected per target +// Platform #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__OpenBSD__) #define LLDB_EDITLINE_USE_WCHAR 1 Index: lldb/trunk/include/lldb/Host/MainLoop.h =================================================================== --- lldb/trunk/include/lldb/Host/MainLoop.h +++ lldb/trunk/include/lldb/Host/MainLoop.h @@ -21,12 +21,12 @@ namespace lldb_private { -// Implementation of the MainLoopBase class. It can monitor file descriptors for -// readability using ppoll, kqueue, poll or WSAPoll. On Windows it only supports -// polling sockets, and will not work on generic file handles or pipes. On -// systems without kqueue or ppoll handling singnals is not supported. In -// addition to the common base, this class provides the ability to invoke a -// given handler when a signal is received. +// Implementation of the MainLoopBase class. It can monitor file descriptors +// for readability using ppoll, kqueue, poll or WSAPoll. On Windows it only +// supports polling sockets, and will not work on generic file handles or +// pipes. On systems without kqueue or ppoll handling singnals is not +// supported. In addition to the common base, this class provides the ability +// to invoke a given handler when a signal is received. // // Since this class is primarily intended to be used for single-threaded // processing, it does not attempt to perform any internal synchronisation and @@ -49,13 +49,13 @@ const Callback &callback, Status &error) override; - // Listening for signals from multiple MainLoop instances is perfectly safe as - // long as they don't try to listen for the same signal. The callback function - // is invoked when the control returns to the Run() function, not when the - // hander is executed. This mean that you can treat the callback as a normal - // function and perform things which would not be safe in a signal handler. - // However, since the callback is not invoked synchronously, you cannot use - // this mechanism to handle SIGSEGV and the like. + // Listening for signals from multiple MainLoop instances is perfectly safe + // as long as they don't try to listen for the same signal. The callback + // function is invoked when the control returns to the Run() function, not + // when the hander is executed. This mean that you can treat the callback as + // a normal function and perform things which would not be safe in a signal + // handler. However, since the callback is not invoked synchronously, you + // cannot use this mechanism to handle SIGSEGV and the like. SignalHandleUP RegisterSignal(int signo, const Callback &callback, Status &error); Index: lldb/trunk/include/lldb/Host/MainLoopBase.h =================================================================== --- lldb/trunk/include/lldb/Host/MainLoopBase.h +++ lldb/trunk/include/lldb/Host/MainLoopBase.h @@ -18,21 +18,17 @@ namespace lldb_private { // The purpose of this class is to enable multiplexed processing of data from -// different sources -// without resorting to multi-threading. Clients can register IOObjects, which -// will be monitored -// for readability, and when they become ready, the specified callback will be -// invoked. -// Monitoring for writability is not supported, but can be easily added if -// needed. +// different sources without resorting to multi-threading. Clients can register +// IOObjects, which will be monitored for readability, and when they become +// ready, the specified callback will be invoked. Monitoring for writability is +// not supported, but can be easily added if needed. // // The RegisterReadObject function return a handle, which controls the duration -// of the monitoring. When -// this handle is destroyed, the callback is deregistered. +// of the monitoring. When this handle is destroyed, the callback is +// deregistered. // // This class simply defines the interface common for all platforms, actual -// implementations are -// platform-specific. +// implementations are platform-specific. class MainLoopBase { private: class ReadHandle; @@ -52,8 +48,7 @@ } // Waits for registered events and invoke the proper callbacks. Returns when - // all callbacks - // deregister themselves or when someone requests termination. + // all callbacks deregister themselves or when someone requests termination. virtual Status Run() { llvm_unreachable("Not implemented"); } // Requests the exit of the Run() function. Index: lldb/trunk/include/lldb/Host/PosixApi.h =================================================================== --- lldb/trunk/include/lldb/Host/PosixApi.h +++ lldb/trunk/include/lldb/Host/PosixApi.h @@ -11,8 +11,8 @@ #define liblldb_Host_PosixApi_h // This file defines platform specific functions, macros, and types necessary -// to provide a minimum level of compatibility across all platforms to rely -// on various posix api functionality. +// to provide a minimum level of compatibility across all platforms to rely on +// various posix api functionality. #if defined(_WIN32) #include "lldb/Host/windows/PosixApi.h" Index: lldb/trunk/include/lldb/Host/Predicate.h =================================================================== --- lldb/trunk/include/lldb/Host/Predicate.h +++ lldb/trunk/include/lldb/Host/Predicate.h @@ -199,11 +199,11 @@ //------------------------------------------------------------------ T WaitForSetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0)) { - // pthread_cond_timedwait() or pthread_cond_wait() will atomically - // unlock the mutex and wait for the condition to be set. When either - // function returns, they will re-lock the mutex. We use an auto lock/unlock - // class (std::lock_guard) to allow us to return at any point in this - // function and not have to worry about unlocking the mutex. + // pthread_cond_timedwait() or pthread_cond_wait() will atomically unlock + // the mutex and wait for the condition to be set. When either function + // returns, they will re-lock the mutex. We use an auto lock/unlock class + // (std::lock_guard) to allow us to return at any point in this function + // and not have to worry about unlocking the mutex. std::unique_lock lock(m_mutex); #ifdef DB_PTHREAD_LOG_EVENTS printf("%s (bits = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", @@ -253,11 +253,11 @@ //------------------------------------------------------------------ T WaitForResetValueBits(T bits, const std::chrono::microseconds &timeout = std::chrono::microseconds(0)) { - // pthread_cond_timedwait() or pthread_cond_wait() will atomically - // unlock the mutex and wait for the condition to be set. When either - // function returns, they will re-lock the mutex. We use an auto lock/unlock - // class (std::lock_guard) to allow us to return at any point in this - // function and not have to worry about unlocking the mutex. + // pthread_cond_timedwait() or pthread_cond_wait() will atomically unlock + // the mutex and wait for the condition to be set. When either function + // returns, they will re-lock the mutex. We use an auto lock/unlock class + // (std::lock_guard) to allow us to return at any point in this function + // and not have to worry about unlocking the mutex. std::unique_lock lock(m_mutex); #ifdef DB_PTHREAD_LOG_EVENTS @@ -313,11 +313,11 @@ bool WaitForValueEqualTo(T value, const std::chrono::microseconds &timeout = std::chrono::microseconds(0), bool *timed_out = nullptr) { - // pthread_cond_timedwait() or pthread_cond_wait() will atomically - // unlock the mutex and wait for the condition to be set. When either - // function returns, they will re-lock the mutex. We use an auto lock/unlock - // class (std::lock_guard) to allow us to return at any point in this - // function and not have to worry about unlocking the mutex. + // pthread_cond_timedwait() or pthread_cond_wait() will atomically unlock + // the mutex and wait for the condition to be set. When either function + // returns, they will re-lock the mutex. We use an auto lock/unlock class + // (std::lock_guard) to allow us to return at any point in this function + // and not have to worry about unlocking the mutex. std::unique_lock lock(m_mutex); #ifdef DB_PTHREAD_LOG_EVENTS @@ -382,11 +382,11 @@ T wait_value, T new_value, const std::chrono::microseconds &timeout = std::chrono::microseconds(0), bool *timed_out = nullptr) { - // pthread_cond_timedwait() or pthread_cond_wait() will atomically - // unlock the mutex and wait for the condition to be set. When either - // function returns, they will re-lock the mutex. We use an auto lock/unlock - // class (std::lock_guard) to allow us to return at any point in this - // function and not have to worry about unlocking the mutex. + // pthread_cond_timedwait() or pthread_cond_wait() will atomically unlock + // the mutex and wait for the condition to be set. When either function + // returns, they will re-lock the mutex. We use an auto lock/unlock class + // (std::lock_guard) to allow us to return at any point in this function + // and not have to worry about unlocking the mutex. std::unique_lock lock(m_mutex); #ifdef DB_PTHREAD_LOG_EVENTS @@ -449,11 +449,11 @@ bool WaitForValueNotEqualTo( T value, T &new_value, const std::chrono::microseconds &timeout = std::chrono::microseconds(0)) { - // pthread_cond_timedwait() or pthread_cond_wait() will atomically - // unlock the mutex and wait for the condition to be set. When either - // function returns, they will re-lock the mutex. We use an auto lock/unlock - // class (std::lock_guard) to allow us to return at any point in this - // function and not have to worry about unlocking the mutex. + // pthread_cond_timedwait() or pthread_cond_wait() will atomically unlock + // the mutex and wait for the condition to be set. When either function + // returns, they will re-lock the mutex. We use an auto lock/unlock class + // (std::lock_guard) to allow us to return at any point in this function + // and not have to worry about unlocking the mutex. std::unique_lock lock(m_mutex); #ifdef DB_PTHREAD_LOG_EVENTS printf("%s (value = 0x%8.8x, timeout = %llu), m_value = 0x%8.8x\n", @@ -478,8 +478,8 @@ protected: //---------------------------------------------------------------------- - // pthread condition and mutex variable to control access and allow - // blocking between the main thread and the spotlight index thread. + // pthread condition and mutex variable to control access and allow blocking + // between the main thread and the spotlight index thread. //---------------------------------------------------------------------- T m_value; ///< The templatized value T that we are protecting access to mutable std::mutex m_mutex; ///< The mutex to use when accessing the data Index: lldb/trunk/include/lldb/Host/Socket.h =================================================================== --- lldb/trunk/include/lldb/Host/Socket.h +++ lldb/trunk/include/lldb/Host/Socket.h @@ -60,10 +60,8 @@ virtual Status Accept(Socket *&socket) = 0; // Initialize a Tcp Socket object in listening mode. listen and accept are - // implemented - // separately because the caller may wish to manipulate or query the socket - // after it is - // initialized, but before entering a blocking accept. + // implemented separately because the caller may wish to manipulate or query + // the socket after it is initialized, but before entering a blocking accept. static Status TcpListen(llvm::StringRef host_and_port, bool child_processes_inherit, Socket *&socket, Predicate *predicate, int backlog = 5); Index: lldb/trunk/include/lldb/Host/SocketAddress.h =================================================================== --- lldb/trunk/include/lldb/Host/SocketAddress.h +++ lldb/trunk/include/lldb/Host/SocketAddress.h @@ -111,17 +111,16 @@ uint16_t GetPort() const; //------------------------------------------------------------------ - // Set the port if the socket address for the family has a port. - // The family must be set correctly prior to calling this function. + // Set the port if the socket address for the family has a port. The family + // must be set correctly prior to calling this function. //------------------------------------------------------------------ bool SetPort(uint16_t port); //------------------------------------------------------------------ - // Set the socket address according to the first match from a call - // to getaddrinfo() (or equivalent functions for systems that don't - // have getaddrinfo(). If "addr_info_ptr" is not NULL, it will get - // filled in with the match that was used to populate this socket - // address. + // Set the socket address according to the first match from a call to + // getaddrinfo() (or equivalent functions for systems that don't have + // getaddrinfo(). If "addr_info_ptr" is not NULL, it will get filled in with + // the match that was used to populate this socket address. //------------------------------------------------------------------ bool getaddrinfo(const char *host, // Hostname ("foo.bar.com" or "foo" or IP @@ -133,9 +132,9 @@ int ai_protocol = 0, int ai_flags = 0); //------------------------------------------------------------------ - // Quick way to set the SocketAddress to localhost given the family. - // Returns true if successful, false if "family" doesn't support - // localhost or if "family" is not supported by this class. + // Quick way to set the SocketAddress to localhost given the family. Returns + // true if successful, false if "family" doesn't support localhost or if + // "family" is not supported by this class. //------------------------------------------------------------------ bool SetToLocalhost(sa_family_t family, uint16_t port); @@ -190,11 +189,10 @@ } //------------------------------------------------------------------ - // Conversion operators to allow getting the contents of this class - // as a pointer to the appropriate structure. This allows an instance - // of this class to be used in calls that take one of the sockaddr - // structure variants without having to manually use the correct - // accessor function. + // Conversion operators to allow getting the contents of this class as a + // pointer to the appropriate structure. This allows an instance of this + // class to be used in calls that take one of the sockaddr structure variants + // without having to manually use the correct accessor function. //------------------------------------------------------------------ operator struct sockaddr *() { return &m_socket_addr.sa; } Index: lldb/trunk/include/lldb/Host/Symbols.h =================================================================== --- lldb/trunk/include/lldb/Host/Symbols.h +++ lldb/trunk/include/lldb/Host/Symbols.h @@ -29,16 +29,16 @@ //---------------------------------------------------------------------- // Locate the executable file given a module specification. // - // Locating the file should happen only on the local computer or using - // the current computers global settings. + // Locating the file should happen only on the local computer or using the + // current computers global settings. //---------------------------------------------------------------------- static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec); //---------------------------------------------------------------------- // Locate the symbol file given a module specification. // - // Locating the file should happen only on the local computer or using - // the current computers global settings. + // Locating the file should happen only on the local computer or using the + // current computers global settings. //---------------------------------------------------------------------- static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec); @@ -51,10 +51,10 @@ // // Locating the file can try to download the file from a corporate build // repository, or using any other means necessary to locate both the - // unstripped object file and the debug symbols. - // The force_lookup argument controls whether the external program is called - // unconditionally to find the symbol file, or if the user's settings are - // checked to see if they've enabled the external program before calling. + // unstripped object file and the debug symbols. The force_lookup argument + // controls whether the external program is called unconditionally to find + // the symbol file, or if the user's settings are checked to see if they've + // enabled the external program before calling. // //---------------------------------------------------------------------- static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, Index: lldb/trunk/include/lldb/Host/TaskPool.h =================================================================== --- lldb/trunk/include/lldb/Host/TaskPool.h +++ lldb/trunk/include/lldb/Host/TaskPool.h @@ -20,32 +20,27 @@ namespace lldb_private { -// Global TaskPool class for running tasks in parallel on a set of worker thread -// created the first -// time the task pool is used. The TaskPool provide no guarantee about the order -// the task will be run -// and about what tasks will run in parallel. None of the task added to the task -// pool should block -// on something (mutex, future, condition variable) what will be set only by the -// completion of an -// other task on the task pool as they may run on the same thread sequentally. +// Global TaskPool class for running tasks in parallel on a set of worker +// thread created the first time the task pool is used. The TaskPool provide no +// guarantee about the order the task will be run and about what tasks will run +// in parallel. None of the task added to the task pool should block on +// something (mutex, future, condition variable) what will be set only by the +// completion of an other task on the task pool as they may run on the same +// thread sequentally. class TaskPool { public: // Add a new task to the task pool and return a std::future belonging to the - // newly created task. - // The caller of this function has to wait on the future for this task to - // complete. + // newly created task. The caller of this function has to wait on the future + // for this task to complete. template static std::future::type> AddTask(F &&f, Args &&... args); // Run all of the specified tasks on the task pool and wait until all of them - // are finished - // before returning. This method is intended to be used for small number tasks - // where listing - // them as function arguments is acceptable. For running large number of tasks - // you should use - // AddTask for each task and then call wait() on each returned future. + // are finished before returning. This method is intended to be used for + // small number tasks where listing them as function arguments is acceptable. + // For running large number of tasks you should use AddTask for each task and + // then call wait() on each returned future. template static void RunTasks(T &&... tasks); private: Index: lldb/trunk/include/lldb/Host/XML.h =================================================================== --- lldb/trunk/include/lldb/Host/XML.h +++ lldb/trunk/include/lldb/Host/XML.h @@ -100,8 +100,8 @@ void ForEachSiblingElement(NodeCallback const &callback) const; //---------------------------------------------------------------------- - // Iterate through only the sibling nodes that are elements and whose - // name matches \a name. + // Iterate through only the sibling nodes that are elements and whose name + // matches \a name. //---------------------------------------------------------------------- void ForEachSiblingElementWithName(const char *name, NodeCallback const &callback) const; @@ -137,8 +137,8 @@ const char *url = "untitled.xml"); //---------------------------------------------------------------------- - // If \a name is nullptr, just get the root element node, else only return - // a value XMLNode if the name of the root element matches \a name. + // If \a name is nullptr, just get the root element node, else only return a + // value XMLNode if the name of the root element matches \a name. //---------------------------------------------------------------------- XMLNode GetRootElement(const char *required_name = nullptr); @@ -176,12 +176,11 @@ StructuredData::ObjectSP GetStructuredData(); protected: - // Using a node returned from GetValueNode() extract its value as a - // string (if possible). Array and dictionary nodes will return false - // as they have no string value. Boolean nodes will return true and - // \a value will be "true" or "false" as the string value comes from - // the element name itself. All other nodes will return the text - // content of the XMLNode. + // Using a node returned from GetValueNode() extract its value as a string + // (if possible). Array and dictionary nodes will return false as they have + // no string value. Boolean nodes will return true and \a value will be + // "true" or "false" as the string value comes from the element name itself. + // All other nodes will return the text content of the XMLNode. static bool ExtractStringFromValueNode(const XMLNode &node, std::string &value); Index: lldb/trunk/include/lldb/Host/common/GetOptInc.h =================================================================== --- lldb/trunk/include/lldb/Host/common/GetOptInc.h +++ lldb/trunk/include/lldb/Host/common/GetOptInc.h @@ -19,8 +19,8 @@ // option structure struct option { const char *name; - // has_arg can't be an enum because some compilers complain about - // type mismatches in all the code that assumes it is an int. + // has_arg can't be an enum because some compilers complain about type + // mismatches in all the code that assumes it is an int. int has_arg; int *flag; int val; Index: lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h =================================================================== --- lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h +++ lldb/trunk/include/lldb/Host/common/NativeBreakpoint.h @@ -45,8 +45,8 @@ private: bool m_enabled; - // ----------------------------------------------------------- - // interface for NativeBreakpointList + // ----------------------------------------------------------- interface for + // NativeBreakpointList // ----------------------------------------------------------- void AddRef(); int32_t DecRef(); Index: lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h =================================================================== --- lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h +++ lldb/trunk/include/lldb/Host/common/NativeProcessProtocol.h @@ -69,8 +69,8 @@ virtual Status Kill() = 0; //------------------------------------------------------------------ - // Tells a process not to stop the inferior on given signals - // and just reinject them back. + // Tells a process not to stop the inferior on given signals and just + // reinject them back. //------------------------------------------------------------------ virtual Status IgnoreSignals(llvm::ArrayRef signals); @@ -421,33 +421,30 @@ int m_terminal_fd; uint32_t m_stop_id = 0; - // Set of signal numbers that LLDB directly injects back to inferior - // without stopping it. + // Set of signal numbers that LLDB directly injects back to inferior without + // stopping it. llvm::DenseSet m_signals_to_ignore; // lldb_private::Host calls should be used to launch a process for debugging, - // and - // then the process should be attached to. When attaching to a process - // lldb_private::Host calls should be used to locate the process to attach to, - // and then this function should be called. + // and then the process should be attached to. When attaching to a process + // lldb_private::Host calls should be used to locate the process to attach + // to, and then this function should be called. NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate); - // ----------------------------------------------------------- - // Internal interface for state handling + // ----------------------------------------------------------- Internal + // interface for state handling // ----------------------------------------------------------- void SetState(lldb::StateType state, bool notify_delegates = true); - // Derived classes need not implement this. It can be used as a - // hook to clear internal caches that should be invalidated when - // stop ids change. + // Derived classes need not implement this. It can be used as a hook to + // clear internal caches that should be invalidated when stop ids change. // - // Note this function is called with the state mutex obtained - // by the caller. + // Note this function is called with the state mutex obtained by the caller. virtual void DoStopIDBumped(uint32_t newBumpId); - // ----------------------------------------------------------- - // Internal interface for software breakpoints + // ----------------------------------------------------------- Internal + // interface for software breakpoints // ----------------------------------------------------------- Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); Index: lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h =================================================================== --- lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h +++ lldb/trunk/include/lldb/Host/common/NativeRegisterContext.h @@ -98,17 +98,14 @@ virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index); // MIPS Linux kernel returns a masked address (last 3bits are masked) - // when a HW watchpoint is hit. However user may not have set a watchpoint - // on this address. This function emulates the instruction at PC and - // finds the base address used in the load/store instruction. This gives the - // exact address used to read/write the variable being watched. - // For example: - // 'n' is at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at - // 'm', + // when a HW watchpoint is hit. However user may not have set a watchpoint on + // this address. This function emulates the instruction at PC and finds the + // base address used in the load/store instruction. This gives the exact + // address used to read/write the variable being watched. For example: 'n' is + // at 0x120010d00 and 'm' is 0x120010d04. When a watchpoint is set at 'm', // then watch exception is generated even when 'n' is read/written. This - // function - // returns address of 'n' so that client can check whether a watchpoint is set - // on this address or not. + // function returns address of 'n' so that client can check whether a + // watchpoint is set on this address or not. virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index); virtual bool HardwareSingleStep(bool enable); Index: lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h =================================================================== --- lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ lldb/trunk/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -104,8 +104,8 @@ Predicate m_port_predicate; // Used when binding to port zero to wait for the thread - // that creates the socket, binds and listens to resolve - // the port number. + // that creates the socket, binds and listens to + // resolve the port number. Pipe m_pipe; std::recursive_mutex m_mutex; Index: lldb/trunk/include/lldb/Interpreter/CommandAlias.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandAlias.h +++ lldb/trunk/include/lldb/Interpreter/CommandAlias.h @@ -74,8 +74,8 @@ OptionArgVectorSP GetOptionArguments() const { return m_option_args_sp; } const char *GetOptionString() { return m_option_string.c_str(); } - // this takes an alias - potentially nested (i.e. an alias to an alias) - // and expands it all the way to a non-alias command + // this takes an alias - potentially nested (i.e. an alias to an alias) and + // expands it all the way to a non-alias command std::pair Desugar(); protected: Index: lldb/trunk/include/lldb/Interpreter/CommandCompletions.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandCompletions.h +++ lldb/trunk/include/lldb/Interpreter/CommandCompletions.h @@ -29,9 +29,8 @@ public: //---------------------------------------------------------------------- // This is the command completion callback that is used to complete the - // argument of the option - // it is bound to (in the OptionDefinition table below). Return the total - // number of matches. + // argument of the option it is bound to (in the OptionDefinition table + // below). Return the total number of matches. //---------------------------------------------------------------------- typedef int (*CompletionCallback)( CommandInterpreter &interpreter, @@ -54,9 +53,9 @@ ePlatformPluginCompletion = (1u << 6), eArchitectureCompletion = (1u << 7), eVariablePathCompletion = (1u << 8), - // This item serves two purposes. It is the last element in the enum, - // so you can add custom enums starting from here in your Option class. - // Also if you & in this bit the base code will not process the option. + // This item serves two purposes. It is the last element in the enum, so + // you can add custom enums starting from here in your Option class. Also + // if you & in this bit the base code will not process the option. eCustomCompletion = (1u << 9) } CommonCompletionTypes; @@ -133,9 +132,8 @@ lldb_private::StringList &matches); //---------------------------------------------------------------------- - // The Completer class is a convenient base class for building searchers - // that go along with the SearchFilter passed to the standard Completer - // functions. + // The Completer class is a convenient base class for building searchers that + // go along with the SearchFilter passed to the standard Completer functions. //---------------------------------------------------------------------- class Completer : public Searcher { public: Index: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h +++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h @@ -86,11 +86,10 @@ m_add_to_history = value; } // These return the default behaviors if the behavior is not - // eLazyBoolCalculate. - // But I've also left the ivars public since for different ways of running the - // interpreter you might want to force different defaults... In that case, - // just grab - // the LazyBool ivars directly and do what you want with eLazyBoolCalculate. + // eLazyBoolCalculate. But I've also left the ivars public since for + // different ways of running the interpreter you might want to force + // different defaults... In that case, just grab the LazyBool ivars directly + // and do what you want with eLazyBoolCalculate. bool GetStopOnContinue() const { return DefaultToNo(m_stop_on_continue); } void SetStopOnContinue(bool stop_on_continue) { @@ -293,26 +292,19 @@ CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line); // This handles command line completion. You are given a pointer to the - // command string buffer, to the current cursor, - // and to the end of the string (in case it is not NULL terminated). - // You also passed in an StringList object to fill with the returns. - // The first element of the array will be filled with the string that you - // would need to insert at - // the cursor point to complete the cursor point to the longest common - // matching prefix. - // If you want to limit the number of elements returned, set - // max_return_elements to the number of elements - // you want returned. Otherwise set max_return_elements to -1. - // If you want to start some way into the match list, then set - // match_start_point to the desired start - // point. - // Returns: - // -1 if the completion character should be inserted - // -2 if the entire command line should be deleted and replaced with - // matches.GetStringAtIndex(0) + // command string buffer, to the current cursor, and to the end of the string + // (in case it is not NULL terminated). You also passed in an StringList + // object to fill with the returns. The first element of the array will be + // filled with the string that you would need to insert at the cursor point + // to complete the cursor point to the longest common matching prefix. If you + // want to limit the number of elements returned, set max_return_elements to + // the number of elements you want returned. Otherwise set + // max_return_elements to -1. If you want to start some way into the match + // list, then set match_start_point to the desired start point. Returns: -1 + // if the completion character should be inserted -2 if the entire command + // line should be deleted and replaced with matches.GetStringAtIndex(0) // INT_MAX if the number of matches is > max_return_elements, but it is - // expensive to compute. - // Otherwise, returns the number of matches. + // expensive to compute. Otherwise, returns the number of matches. // // FIXME: Only max_return_elements == -1 is supported at present. int HandleCompletion(const char *current_line, const char *cursor, @@ -320,11 +312,10 @@ int max_return_elements, StringList &matches); // This version just returns matches, and doesn't compute the substring. It - // is here so the - // Help command can call it for the first argument. + // is here so the Help command can call it for the first argument. // word_complete tells whether the completions are considered a "complete" - // response (so the - // completer should complete the quote & put a space after the word. + // response (so the completer should complete the quote & put a space after + // the word. int HandleCompletionMatches(Args &input, int &cursor_index, int &cursor_char_position, int match_start_point, int max_return_elements, bool &word_complete, Index: lldb/trunk/include/lldb/Interpreter/CommandObject.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObject.h +++ lldb/trunk/include/lldb/Interpreter/CommandObject.h @@ -32,9 +32,8 @@ // This function really deals with CommandObjectLists, but we didn't make a // CommandObjectList class, so I'm sticking it here. But we really should have // such a class. Anyway, it looks up the commands in the map that match the -// partial -// string cmd_str, inserts the matches into matches, and returns the number -// added. +// partial string cmd_str, inserts the matches into matches, and returns the +// number added. template int AddNamesMatchingPartialString(const std::map &in_map, @@ -138,8 +137,8 @@ void SetSyntax(llvm::StringRef str); - // override this to return true if you want to enable the user to delete - // the Command object from the Command dictionary (aliases have their own + // override this to return true if you want to enable the user to delete the + // Command object from the Command dictionary (aliases have their own // deletion scheme, so they do not need to care about this) virtual bool IsRemovable() const { return false; } @@ -149,9 +148,9 @@ virtual bool IsAlias() { return false; } - // override this to return true if your command is somehow a "dash-dash" - // form of some other command (e.g. po is expr -O --); this is a powerful - // hint to the help system that one cannot pass options to this command + // override this to return true if your command is somehow a "dash-dash" form + // of some other command (e.g. po is expr -O --); this is a powerful hint to + // the help system that one cannot pass options to this command virtual bool IsDashDashCommand() { return false; } virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, @@ -175,10 +174,9 @@ virtual void GenerateHelpText(Stream &result); - // this is needed in order to allow the SBCommand class to - // transparently try and load subcommands - it will fail on - // anything but a multiword command, but it avoids us doing - // type checkings and casts + // this is needed in order to allow the SBCommand class to transparently try + // and load subcommands - it will fail on anything but a multiword command, + // but it avoids us doing type checkings and casts virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) { return false; @@ -186,9 +184,9 @@ virtual bool WantsRawCommandString() = 0; - // By default, WantsCompletion = !WantsRawCommandString. - // Subclasses who want raw command string but desire, for example, - // argument completion should override this method to return true. + // By default, WantsCompletion = !WantsRawCommandString. Subclasses who want + // raw command string but desire, for example, argument completion should + // override this method to return true. virtual bool WantsCompletion() { return !WantsRawCommandString(); } virtual Options *GetOptions(); @@ -210,10 +208,10 @@ static const char *GetArgumentName(lldb::CommandArgumentType arg_type); // Generates a nicely formatted command args string for help command output. - // By default, all possible args are taken into account, for example, - // ''. This can be refined by passing a second arg - // specifying which option set(s) we are interested, which could then, for - // example, produce either '' or ''. + // By default, all possible args are taken into account, for example, ''. This can be refined by passing a second arg specifying + // which option set(s) we are interested, which could then, for example, + // produce either '' or ''. void GetFormattedCommandArguments(Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL); @@ -415,18 +413,16 @@ } // This is for use in the command interpreter, when you either want the - // selected target, or if no target - // is present you want to prime the dummy target with entities that will be - // copied over to new targets. + // selected target, or if no target is present you want to prime the dummy + // target with entities that will be copied over to new targets. Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); Target *GetDummyTarget(); - // If a command needs to use the "current" thread, use this call. - // Command objects will have an ExecutionContext to use, and that may or may - // not have a thread in it. If it - // does, you should use that by default, if not, then use the - // ExecutionContext's target's selected thread, etc... - // This call insulates you from the details of this calculation. + // If a command needs to use the "current" thread, use this call. Command + // objects will have an ExecutionContext to use, and that may or may not have + // a thread in it. If it does, you should use that by default, if not, then + // use the ExecutionContext's target's selected thread, etc... This call + // insulates you from the details of this calculation. Thread *GetDefaultThread(); //------------------------------------------------------------------ Index: lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h +++ lldb/trunk/include/lldb/Interpreter/CommandObjectMultiword.h @@ -87,8 +87,8 @@ ~CommandObjectProxy() override; - // Subclasses must provide a command object that will be transparently - // used for this object. + // Subclasses must provide a command object that will be transparently used + // for this object. virtual CommandObject *GetProxyCommandObject() = 0; llvm::StringRef GetHelpLong() override; Index: lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h +++ lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h @@ -24,9 +24,9 @@ class OptionGroupBoolean : public OptionGroup { public: - // When 'no_argument_toggle_default' is true, then setting the option - // value does NOT require an argument, it sets the boolean value to the - // inverse of the default value + // When 'no_argument_toggle_default' is true, then setting the option value + // does NOT require an argument, it sets the boolean value to the inverse of + // the default value OptionGroupBoolean(uint32_t usage_mask, bool required, const char *long_option, int short_option, const char *usage_text, bool default_value, Index: lldb/trunk/include/lldb/Interpreter/OptionValue.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValue.h +++ lldb/trunk/include/lldb/Interpreter/OptionValue.h @@ -76,8 +76,8 @@ //----------------------------------------------------------------- virtual Type GetType() const = 0; - // If this value is always hidden, the avoid showing any info on this - // value, just show the info for the child values. + // If this value is always hidden, the avoid showing any info on this value, + // just show the info for the child values. virtual bool ValueIsTransparent() const { return GetType() == eTypeProperties; } @@ -126,8 +126,8 @@ virtual bool DumpQualifiedName(Stream &strm) const; //----------------------------------------------------------------- - // Subclasses should NOT override these functions as they use the - // above functions to implement functionality + // Subclasses should NOT override these functions as they use the above + // functions to implement functionality //----------------------------------------------------------------- uint32_t GetTypeAsMask() { return 1u << GetType(); } @@ -183,9 +183,8 @@ CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask, Status &error); - // Get this value as a uint64_t value if it is encoded as a boolean, - // uint64_t or int64_t. Other types will cause "fail_value" to be - // returned + // Get this value as a uint64_t value if it is encoded as a boolean, uint64_t + // or int64_t. Other types will cause "fail_value" to be returned uint64_t GetUInt64Value(uint64_t fail_value, bool *success_ptr); OptionValueArch *GetAsArch(); @@ -339,10 +338,10 @@ void *m_baton; bool m_value_was_set; // This can be used to see if a value has been set // by a call to SetValueFromCString(). It is often - // handy to know if an option value was set from - // the command line or as a setting, versus if we - // just have the default value that was already - // populated in the option value. + // handy to know if an option value was set from the + // command line or as a setting, versus if we just have + // the default value that was already populated in the + // option value. }; } // namespace lldb_private Index: lldb/trunk/include/lldb/Interpreter/OptionValueArray.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueArray.h +++ lldb/trunk/include/lldb/Interpreter/OptionValueArray.h @@ -78,8 +78,8 @@ } bool AppendValue(const lldb::OptionValueSP &value_sp) { - // Make sure the value_sp object is allowed to contain - // values of the type passed in... + // Make sure the value_sp object is allowed to contain values of the type + // passed in... if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) { m_values.push_back(value_sp); return true; @@ -88,8 +88,8 @@ } bool InsertValue(size_t idx, const lldb::OptionValueSP &value_sp) { - // Make sure the value_sp object is allowed to contain - // values of the type passed in... + // Make sure the value_sp object is allowed to contain values of the type + // passed in... if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) { if (idx < m_values.size()) m_values.insert(m_values.begin() + idx, value_sp); @@ -101,8 +101,8 @@ } bool ReplaceValue(size_t idx, const lldb::OptionValueSP &value_sp) { - // Make sure the value_sp object is allowed to contain - // values of the type passed in... + // Make sure the value_sp object is allowed to contain values of the type + // passed in... if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) { if (idx < m_values.size()) { m_values[idx] = value_sp; Index: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h +++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h @@ -75,15 +75,15 @@ //--------------------------------------------------------------------- // Get the index of a property given its exact name in this property - // collection, "name" can't be a path to a property path that refers - // to a property within a property + // collection, "name" can't be a path to a property path that refers to a + // property within a property //--------------------------------------------------------------------- virtual uint32_t GetPropertyIndex(const ConstString &name) const; //--------------------------------------------------------------------- - // Get a property by exact name exists in this property collection, name - // can not be a path to a property path that refers to a property within - // a property + // Get a property by exact name exists in this property collection, name can + // not be a path to a property path that refers to a property within a + // property //--------------------------------------------------------------------- virtual const Property *GetProperty(const ExecutionContext *exe_ctx, bool will_modify, Index: lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h +++ lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h @@ -34,9 +34,9 @@ //--------------------------------------------------------------------- // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object - // inside of a lldb::OptionValueSP object if all goes well. If the - // string isn't a uint64_t value or any other error occurs, return an - // empty lldb::OptionValueSP and fill error in with the correct stuff. + // inside of a lldb::OptionValueSP object if all goes well. If the string + // isn't a uint64_t value or any other error occurs, return an empty + // lldb::OptionValueSP and fill error in with the correct stuff. //--------------------------------------------------------------------- static lldb::OptionValueSP Create(const char *, Status &) = delete; static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error); Index: lldb/trunk/include/lldb/Interpreter/Options.h =================================================================== --- lldb/trunk/include/lldb/Interpreter/Options.h +++ lldb/trunk/include/lldb/Interpreter/Options.h @@ -92,9 +92,9 @@ bool VerifyOptions(CommandReturnObject &result); - // Verify that the options given are in the options table and can - // be used together, but there may be some required options that are - // missing (used to verify options that get folded into command aliases). + // Verify that the options given are in the options table and can be used + // together, but there may be some required options that are missing (used to + // verify options that get folded into command aliases). bool VerifyPartialOptions(CommandReturnObject &result); void OutputFormattedUsageText(Stream &strm, @@ -106,18 +106,18 @@ bool SupportsLongOption(const char *long_option); - // The following two pure virtual functions must be defined by every - // class that inherits from this class. + // The following two pure virtual functions must be defined by every class + // that inherits from this class. virtual llvm::ArrayRef GetDefinitions() { return llvm::ArrayRef(); } - // Call this prior to parsing any options. This call will call the - // subclass OptionParsingStarting() and will avoid the need for all + // Call this prior to parsing any options. This call will call the subclass + // OptionParsingStarting() and will avoid the need for all // OptionParsingStarting() function instances from having to call the - // Option::OptionParsingStarting() like they did before. This was error - // prone and subclasses shouldn't have to do it. + // Option::OptionParsingStarting() like they did before. This was error prone + // and subclasses shouldn't have to do it. void NotifyOptionParsingStarting(ExecutionContext *execution_context); //------------------------------------------------------------------ @@ -298,14 +298,14 @@ void OptionsSetUnion(const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set); - // Subclasses must reset their option values prior to starting a new - // option parse. Each subclass must override this function and revert - // all option settings to default values. + // Subclasses must reset their option values prior to starting a new option + // parse. Each subclass must override this function and revert all option + // settings to default values. virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; virtual Status OptionParsingFinished(ExecutionContext *execution_context) { - // If subclasses need to know when the options are done being parsed - // they can implement this function to do extra checking + // If subclasses need to know when the options are done being parsed they + // can implement this function to do extra checking Status error; return error; } @@ -326,8 +326,8 @@ virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0; virtual Status OptionParsingFinished(ExecutionContext *execution_context) { - // If subclasses need to know when the options are done being parsed - // they can implement this function to do extra checking + // If subclasses need to know when the options are done being parsed they + // can implement this function to do extra checking Status error; return error; } Index: lldb/trunk/include/lldb/Symbol/Block.h =================================================================== --- lldb/trunk/include/lldb/Symbol/Block.h +++ lldb/trunk/include/lldb/Symbol/Block.h @@ -403,8 +403,8 @@ uint32_t GetRangeIndexContainingAddress(const Address &addr); //------------------------------------------------------------------ - // Since blocks might have multiple discontiguous address ranges, - // we need to be able to get at any of the address ranges in a block. + // Since blocks might have multiple discontiguous address ranges, we need to + // be able to get at any of the address ranges in a block. //------------------------------------------------------------------ bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range); Index: lldb/trunk/include/lldb/Symbol/ClangASTContext.h =================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h @@ -638,8 +638,7 @@ //---------------------------------------------------------------------- // Using the current type, create a new typedef to that type using - // "typedef_name" - // as the name and "decl_ctx" as the decl context. + // "typedef_name" as the name and "decl_ctx" as the decl context. static CompilerType CreateTypedefType(const CompilerType &type, const char *typedef_name, const CompilerDeclContext &compiler_decl_ctx); @@ -656,8 +655,7 @@ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override; CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, @@ -769,8 +767,8 @@ bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override; @@ -800,8 +798,8 @@ CompilerType GetTypeForFormatters(void *type) override; #define LLDB_INVALID_DECL_LEVEL UINT32_MAX - // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if - // child_decl_ctx could not be found in decl_ctx. + // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if child_decl_ctx + // could not be found in decl_ctx. uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name = nullptr, @@ -892,13 +890,13 @@ // Pointers & References //------------------------------------------------------------------ - // Call this function using the class type when you want to make a - // member pointer type to pointee_type. + // Call this function using the class type when you want to make a member + // pointer type to pointee_type. static CompilerType CreateMemberPointerType(const CompilerType &type, const CompilerType &pointee_type); - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override; Index: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h =================================================================== --- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h +++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h @@ -250,13 +250,12 @@ // recorded and placed into the decls_to_deport set. // // A call to "ExecuteDeportWorkQueues" completes all the Decls that - // are in decls_to_deport, adding any Decls it sees along the way that - // it hasn't already deported. It proceeds until decls_to_deport is - // empty. + // are in decls_to_deport, adding any Decls it sees along the way that it + // hasn't already deported. It proceeds until decls_to_deport is empty. // - // These calls must be paired. Leaving a minion in deport mode or - // trying to start deport minion with a new pair of queues will result - // in an assertion failure. + // These calls must be paired. Leaving a minion in deport mode or trying + // to start deport minion with a new pair of queues will result in an + // assertion failure. void InitDeportWorkQueues(std::set *decls_to_deport, Index: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h =================================================================== --- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -60,21 +60,21 @@ //------------------------------------------------------------------ clang::Decl *GetExternalDecl(uint32_t ID) override { - // This method only needs to be implemented if the AST source ever - // passes back decl sets as VisibleDeclaration objects. + // This method only needs to be implemented if the AST source ever passes + // back decl sets as VisibleDeclaration objects. return nullptr; } clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override { - // This operation is meant to be used via a LazyOffsetPtr. It only - // needs to be implemented if the AST source uses methods like + // This operation is meant to be used via a LazyOffsetPtr. It only needs + // to be implemented if the AST source uses methods like // FunctionDecl::setLazyBody when building decls. return nullptr; } clang::Selector GetExternalSelector(uint32_t ID) override { - // This operation only needs to be implemented if the AST source - // returns non-zero for GetNumKnownSelectors(). + // This operation only needs to be implemented if the AST source returns + // non-zero for GetNumKnownSelectors(). return clang::Selector(); } Index: lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h =================================================================== --- lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h +++ lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h @@ -22,23 +22,18 @@ namespace lldb_private { // Compact Unwind info is an unwind format used on Darwin. The unwind -// instructions -// for typical compiler-generated functions can be expressed in a 32-bit -// encoding. -// The format includes a two-level index so the unwind information for a -// function -// can be found by two binary searches in the section. It can represent both -// stack frames that use a frame-pointer register and frameless functions, on -// i386/x86_64 for instance. When a function is too complex to be represented -// in -// the compact unwind format, it calls out to eh_frame unwind instructions. +// instructions for typical compiler-generated functions can be expressed in a +// 32-bit encoding. The format includes a two-level index so the unwind +// information for a function can be found by two binary searches in the +// section. It can represent both stack frames that use a frame-pointer +// register and frameless functions, on i386/x86_64 for instance. When a +// function is too complex to be represented in the compact unwind format, it +// calls out to eh_frame unwind instructions. // On Mac OS X / iOS, a function will have either a compact unwind -// representation -// or an eh_frame representation. If lldb is going to benefit from the -// compiler's -// description about saved register locations, it must be able to read both -// sources of information. +// representation or an eh_frame representation. If lldb is going to benefit +// from the compiler's description about saved register locations, it must be +// able to read both sources of information. class CompactUnwindInfo { public: @@ -54,9 +49,8 @@ // The top level index entries of the compact unwind info // (internal representation of struct // unwind_info_section_header_index_entry) - // There are relatively few of these (one per 500/1000 functions, depending on - // format) so - // creating them on first scan will not be too costly. + // There are relatively few of these (one per 500/1000 functions, depending + // on format) so creating them on first scan will not be too costly. struct UnwindIndex { uint32_t function_offset; // The offset of the first function covered by // this index @@ -84,8 +78,7 @@ }; // An internal object used to store the information we retrieve about a - // function -- - // the encoding bits and possibly the LSDA/personality function. + // function -- the encoding bits and possibly the LSDA/personality function. struct FunctionInfo { uint32_t encoding; // compact encoding 32-bit value for this function Address lsda_address; // the address of the LSDA data for this function Index: lldb/trunk/include/lldb/Symbol/CompilerType.h =================================================================== --- lldb/trunk/include/lldb/Symbol/CompilerType.h +++ lldb/trunk/include/lldb/Symbol/CompilerType.h @@ -28,13 +28,12 @@ //---------------------------------------------------------------------- // A class that can carry around a clang ASTContext and a opaque clang -// QualType. A clang::QualType can be easily reconstructed from an -// opaque clang type and often the ASTContext is needed when doing -// various type related tasks, so this class allows both items to travel -// in a single very lightweight class that can be used. There are many -// static equivalents of the member functions that allow the ASTContext -// and the opaque clang QualType to be specified for ease of use and -// to avoid code duplication. +// QualType. A clang::QualType can be easily reconstructed from an opaque clang +// type and often the ASTContext is needed when doing various type related +// tasks, so this class allows both items to travel in a single very +// lightweight class that can be used. There are many static equivalents of the +// member functions that allow the ASTContext and the opaque clang QualType to +// be specified for ease of use and to avoid code duplication. //---------------------------------------------------------------------- class CompilerType { public: @@ -206,8 +205,7 @@ CompilerType GetFullyUnqualifiedType() const; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount() const; CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const; @@ -220,14 +218,14 @@ //---------------------------------------------------------------------- // If this type is a reference to a type (L value or R value reference), - // return a new type with the reference removed, else return the current - // type itself. + // return a new type with the reference removed, else return the current type + // itself. //---------------------------------------------------------------------- CompilerType GetNonReferenceType() const; //---------------------------------------------------------------------- - // If this type is a pointer type, return the type that the pointer - // points to, else return an invalid type. + // If this type is a pointer type, return the type that the pointer points + // to, else return an invalid type. //---------------------------------------------------------------------- CompilerType GetPointeeType() const; @@ -237,44 +235,44 @@ CompilerType GetPointerType() const; //---------------------------------------------------------------------- - // Return a new CompilerType that is a L value reference to this type if - // this type is valid and the type system supports L value references, - // else return an invalid type. + // Return a new CompilerType that is a L value reference to this type if this + // type is valid and the type system supports L value references, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType GetLValueReferenceType() const; //---------------------------------------------------------------------- - // Return a new CompilerType that is a R value reference to this type if - // this type is valid and the type system supports R value references, - // else return an invalid type. + // Return a new CompilerType that is a R value reference to this type if this + // type is valid and the type system supports R value references, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType GetRValueReferenceType() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a const modifier to this type if - // this type is valid and the type system supports const modifiers, - // else return an invalid type. + // Return a new CompilerType adds a const modifier to this type if this type + // is valid and the type system supports const modifiers, else return an + // invalid type. //---------------------------------------------------------------------- CompilerType AddConstModifier() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a volatile modifier to this type if - // this type is valid and the type system supports volatile modifiers, - // else return an invalid type. + // Return a new CompilerType adds a volatile modifier to this type if this + // type is valid and the type system supports volatile modifiers, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType AddVolatileModifier() const; //---------------------------------------------------------------------- - // Return a new CompilerType adds a restrict modifier to this type if - // this type is valid and the type system supports restrict modifiers, - // else return an invalid type. + // Return a new CompilerType adds a restrict modifier to this type if this + // type is valid and the type system supports restrict modifiers, else return + // an invalid type. //---------------------------------------------------------------------- CompilerType AddRestrictModifier() const; //---------------------------------------------------------------------- - // Create a typedef to this type using "name" as the name of the typedef - // this type is valid and the type system supports typedefs, else return - // an invalid type. + // Create a typedef to this type using "name" as the name of the typedef this + // type is valid and the type system supports typedefs, else return an + // invalid type. //---------------------------------------------------------------------- CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx) const; @@ -311,8 +309,8 @@ //---------------------------------------------------------------------- // If this type is an enumeration, iterate through all of its enumerators - // using a callback. If the callback returns true, keep iterating, else - // abort the iteration. + // using a callback. If the callback returns true, keep iterating, else abort + // the iteration. //---------------------------------------------------------------------- void ForEachEnumerator( std::function FunctionAddressAndSizeVector; @@ -55,12 +55,11 @@ // Build a vector of file address and size for all functions in this Module // based on the eh_frame FDE entries. // - // The eh_frame information can be a useful source of file address and size of - // the functions in a Module. Often a binary's non-exported symbols are - // stripped - // before shipping so lldb won't know the start addr / size of many functions - // in the Module. But the eh_frame can help to give the addresses of these - // stripped symbols, at least. + // The eh_frame information can be a useful source of file address and size + // of the functions in a Module. Often a binary's non-exported symbols are + // stripped before shipping so lldb won't know the start addr / size of many + // functions in the Module. But the eh_frame can help to give the addresses + // of these stripped symbols, at least. // // @param[out] function_info // A vector provided by the caller is filled out. May be empty if no @@ -112,10 +111,9 @@ typedef std::map cie_map_t; - // Start address (file address), size, offset of FDE location - // used for finding an FDE for a given File address; the start address field - // is - // an offset into an individual Module. + // Start address (file address), size, offset of FDE location used for + // finding an FDE for a given File address; the start address field is an + // offset into an individual Module. typedef RangeDataVector FDEEntryMap; bool IsEHFrame() const; @@ -133,8 +131,8 @@ void GetCFIData(); // Applies the specified DWARF opcode to the given row. This function handle - // the commands - // operates only on a single row (these are the ones what can appear both in + // the commands operates only on a single row (these are the ones what can + // appear both in // CIE and in FDE). // Returns true if the opcode is handled and false otherwise. bool HandleCommonDwarfOpcode(uint8_t primary_opcode, uint8_t extended_opcode, Index: lldb/trunk/include/lldb/Symbol/DeclVendor.h =================================================================== --- lldb/trunk/include/lldb/Symbol/DeclVendor.h +++ lldb/trunk/include/lldb/Symbol/DeclVendor.h @@ -20,9 +20,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -// The Decl vendor class is intended as a generic interface to search -// for named declarations that are not necessarily backed by a specific -// symbol file. +// The Decl vendor class is intended as a generic interface to search for named +// declarations that are not necessarily backed by a specific symbol file. //---------------------------------------------------------------------- class DeclVendor { public: Index: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h =================================================================== --- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h +++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h @@ -12,8 +12,8 @@ class FuncUnwinders { public: - // FuncUnwinders objects are used to track UnwindPlans for a function - // (named or not - really just an address range) + // FuncUnwinders objects are used to track UnwindPlans for a function (named + // or not - really just an address range) // We'll record four different UnwindPlans for each address range: // @@ -28,8 +28,8 @@ // available for some reason. // Additionally, FuncUnwinds object can be asked where the prologue - // instructions are finished for migrating breakpoints past the - // stack frame setup instructions when we don't have line table information. + // instructions are finished for migrating breakpoints past the stack frame + // setup instructions when we don't have line table information. FuncUnwinders(lldb_private::UnwindTable &unwind_table, AddressRange range); @@ -38,10 +38,8 @@ // current_offset is the byte offset into the function. // 0 means no instructions have executed yet. -1 means the offset is unknown. // On architectures where the pc points to the next instruction that will - // execute, this - // offset value will have already been decremented by 1 to stay within the - // bounds of the - // correct function body. + // execute, this offset value will have already been decremented by 1 to stay + // within the bounds of the correct function body. lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target, int current_offset); @@ -69,24 +67,19 @@ // A function may have a Language Specific Data Area specified -- a block of // data in // the object file which is used in the processing of an exception throw / - // catch. - // If any of the UnwindPlans have the address of the LSDA region for this - // function, - // this will return it. + // catch. If any of the UnwindPlans have the address of the LSDA region for + // this function, this will return it. Address GetLSDAAddress(Target &target); // A function may have a Personality Routine associated with it -- used in the // processing of throwing an exception. If any of the UnwindPlans have the - // address of the personality routine, this will return it. Read the - // target-pointer - // at this address to get the personality function address. + // address of the personality routine, this will return it. Read the target- + // pointer at this address to get the personality function address. Address GetPersonalityRoutinePtrAddress(Target &target); // The following methods to retrieve specific unwind plans should rarely be - // used. - // Instead, clients should ask for the *behavior* they are looking for, using - // one - // of the above UnwindPlan retrieval methods. + // used. Instead, clients should ask for the *behavior* they are looking for, + // using one of the above UnwindPlan retrieval methods. lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread, int current_offset); @@ -116,11 +109,11 @@ private: lldb::UnwindAssemblySP GetUnwindAssemblyProfiler(Target &target); - // Do a simplistic comparison for the register restore rule for getting - // the caller's pc value on two UnwindPlans -- returns LazyBoolYes if - // they have the same unwind rule for the pc, LazyBoolNo if they do not - // have the same unwind rule for the pc, and LazyBoolCalculate if it was - // unable to determine this for some reason. + // Do a simplistic comparison for the register restore rule for getting the + // caller's pc value on two UnwindPlans -- returns LazyBoolYes if they have + // the same unwind rule for the pc, LazyBoolNo if they do not have the same + // unwind rule for the pc, and LazyBoolCalculate if it was unable to + // determine this for some reason. lldb_private::LazyBool CompareUnwindPlansForIdenticalInitialPCLocation( Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b); @@ -143,8 +136,8 @@ lldb::UnwindPlanSP m_unwind_plan_arch_default_sp; lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp; - // Fetching the UnwindPlans can be expensive - if we've already attempted - // to get one & failed, don't try again. + // Fetching the UnwindPlans can be expensive - if we've already attempted to + // get one & failed, don't try again. bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1, m_tried_unwind_plan_debug_frame : 1, m_tried_unwind_plan_eh_frame_augmented : 1, Index: lldb/trunk/include/lldb/Symbol/GoASTContext.h =================================================================== --- lldb/trunk/include/lldb/Symbol/GoASTContext.h +++ lldb/trunk/include/lldb/Symbol/GoASTContext.h @@ -216,8 +216,7 @@ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override; CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, @@ -294,8 +293,8 @@ bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override; @@ -347,8 +346,8 @@ Stream *s, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size) override; - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override; Index: lldb/trunk/include/lldb/Symbol/ObjectFile.h =================================================================== --- lldb/trunk/include/lldb/Symbol/ObjectFile.h +++ lldb/trunk/include/lldb/Symbol/ObjectFile.h @@ -377,13 +377,13 @@ //------------------------------------------------------------------ virtual Symbol *ResolveSymbolForAddress(const Address &so_addr, bool verify_unique) { - // Typically overridden to lazily add stripped symbols recoverable from - // the exception handling unwind information (i.e. without parsing - // the entire eh_frame section. + // Typically overridden to lazily add stripped symbols recoverable from the + // exception handling unwind information (i.e. without parsing the entire + // eh_frame section. // - // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO - // to efficiently add stripped symbols when the symbol table is - // first constructed. Poorer cousins are PECoff and ELF. + // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO to + // efficiently add stripped symbols when the symbol table is first + // constructed. Poorer cousins are PECoff and ELF. return nullptr; } @@ -791,10 +791,9 @@ return m_strata; } - // When an object file is in memory, subclasses should try and lock - // the process weak pointer. If the process weak pointer produces a - // valid ProcessSP, then subclasses can call this function to read - // memory. + // When an object file is in memory, subclasses should try and lock the + // process weak pointer. If the process weak pointer produces a valid + // ProcessSP, then subclasses can call this function to read memory. static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp, lldb::addr_t addr, size_t byte_size); @@ -814,8 +813,8 @@ size_t dst_len); // This function will transparently decompress section data if the section if - // compressed. Note that for compressed section the resulting data size may be - // larger than what Section::GetFileSize reports. + // compressed. Note that for compressed section the resulting data size may + // be larger than what Section::GetFileSize reports. virtual size_t ReadSectionData(Section *section, DataExtractor §ion_data); Index: lldb/trunk/include/lldb/Symbol/Symbol.h =================================================================== --- lldb/trunk/include/lldb/Symbol/Symbol.h +++ lldb/trunk/include/lldb/Symbol/Symbol.h @@ -20,11 +20,9 @@ class Symbol : public SymbolContextScope { public: - // ObjectFile readers can classify their symbol table entries and searches can - // be made - // on specific types where the symbol values will have drastically different - // meanings - // and sorting requirements. + // ObjectFile readers can classify their symbol table entries and searches + // can be made on specific types where the symbol values will have + // drastically different meanings and sorting requirements. Symbol(); Symbol(uint32_t symID, const char *name, bool name_is_mangled, @@ -52,56 +50,53 @@ bool ValueIsAddress() const; //------------------------------------------------------------------ - // The GetAddressRef() accessor functions should only be called if - // you previously call ValueIsAddress() otherwise you might get an - // reference to an Address object that contains an constant integer - // value in m_addr_range.m_base_addr.m_offset which could be - // incorrectly used to represent an absolute address since it has - // no section. + // The GetAddressRef() accessor functions should only be called if you + // previously call ValueIsAddress() otherwise you might get an reference to + // an Address object that contains an constant integer value in + // m_addr_range.m_base_addr.m_offset which could be incorrectly used to + // represent an absolute address since it has no section. //------------------------------------------------------------------ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); } const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); } //------------------------------------------------------------------ - // Makes sure the symbol's value is an address and returns the file - // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't - // an address. + // Makes sure the symbol's value is an address and returns the file address. + // Returns LLDB_INVALID_ADDRESS if the symbol's value isn't an address. //------------------------------------------------------------------ lldb::addr_t GetFileAddress() const; //------------------------------------------------------------------ - // Makes sure the symbol's value is an address and gets the load - // address using \a target if it is. Returns LLDB_INVALID_ADDRESS - // if the symbol's value isn't an address or if the section isn't - // loaded in \a target. + // Makes sure the symbol's value is an address and gets the load address + // using \a target if it is. Returns LLDB_INVALID_ADDRESS if the symbol's + // value isn't an address or if the section isn't loaded in \a target. //------------------------------------------------------------------ lldb::addr_t GetLoadAddress(Target *target) const; //------------------------------------------------------------------ - // Access the address value. Do NOT hand out the AddressRange as an - // object as the byte size of the address range may not be filled in - // and it should be accessed via GetByteSize(). + // Access the address value. Do NOT hand out the AddressRange as an object as + // the byte size of the address range may not be filled in and it should be + // accessed via GetByteSize(). //------------------------------------------------------------------ Address GetAddress() const { - // Make sure the our value is an address before we hand a copy out. - // We use the Address inside m_addr_range to contain the value for - // symbols that are not address based symbols so we are using it - // for more than just addresses. For example undefined symbols on - // MacOSX have a nlist.n_value of 0 (zero) and this will get placed - // into m_addr_range.m_base_addr.m_offset and it will have no section. - // So in the GetAddress() accessor, we need to hand out an invalid - // address if the symbol's value isn't an address. + // Make sure the our value is an address before we hand a copy out. We use + // the Address inside m_addr_range to contain the value for symbols that + // are not address based symbols so we are using it for more than just + // addresses. For example undefined symbols on MacOSX have a nlist.n_value + // of 0 (zero) and this will get placed into + // m_addr_range.m_base_addr.m_offset and it will have no section. So in the + // GetAddress() accessor, we need to hand out an invalid address if the + // symbol's value isn't an address. if (ValueIsAddress()) return m_addr_range.GetBaseAddress(); else return Address(); } - // When a symbol's value isn't an address, we need to access the raw - // value. This function will ensure this symbol's value isn't an address - // and return the integer value if this checks out, otherwise it will - // return "fail_value" if the symbol is an address value. + // When a symbol's value isn't an address, we need to access the raw value. + // This function will ensure this symbol's value isn't an address and return + // the integer value if this checks out, otherwise it will return + // "fail_value" if the symbol is an address value. uint64_t GetIntegerValue(uint64_t fail_value = 0) const { if (ValueIsAddress()) { // This symbol's value is an address. Use Symbol::GetAddress() to get the @@ -238,9 +233,8 @@ protected: // This is the internal guts of ResolveReExportedSymbol, it assumes - // reexport_name is not null, and that module_spec - // is valid. We track the modules we've already seen to make sure we don't - // get caught in a cycle. + // reexport_name is not null, and that module_spec is valid. We track the + // modules we've already seen to make sure we don't get caught in a cycle. Symbol *ResolveReExportedSymbolInModuleSpec( Target &target, ConstString &reexport_name, @@ -260,8 +254,8 @@ m_size_is_sibling : 1, // m_size contains the index of this symbol's // sibling m_size_is_synthesized : 1, // non-zero if this symbol's size was - // calculated using a delta between this symbol - // and the next + // calculated using a delta between this + // symbol and the next m_size_is_valid : 1, m_demangled_is_synthesized : 1, // The demangled name was created should // not be used for expressions or other Index: lldb/trunk/include/lldb/Symbol/SymbolFile.h =================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolFile.h +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h @@ -26,10 +26,10 @@ //------------------------------------------------------------------ // Symbol file ability bits. // - // Each symbol file can claim to support one or more symbol file - // abilities. These get returned from SymbolFile::GetAbilities(). - // These help us to determine which plug-in will be best to load - // the debug information found in files. + // Each symbol file can claim to support one or more symbol file abilities. + // These get returned from SymbolFile::GetAbilities(). These help us to + // determine which plug-in will be best to load the debug information found + // in files. //------------------------------------------------------------------ enum Abilities { CompileUnits = (1u << 0), Index: lldb/trunk/include/lldb/Symbol/SymbolVendor.h =================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h @@ -22,14 +22,13 @@ namespace lldb_private { //---------------------------------------------------------------------- -// The symbol vendor class is designed to abstract the process of -// searching for debug information for a given module. Platforms can -// subclass this class and provide extra ways to find debug information. -// Examples would be a subclass that would allow for locating a stand -// alone debug file, parsing debug maps, or runtime data in the object -// files. A symbol vendor can use multiple sources (SymbolFile -// objects) to provide the information and only parse as deep as needed -// in order to provide the information that is requested. +// The symbol vendor class is designed to abstract the process of searching for +// debug information for a given module. Platforms can subclass this class and +// provide extra ways to find debug information. Examples would be a subclass +// that would allow for locating a stand alone debug file, parsing debug maps, +// or runtime data in the object files. A symbol vendor can use multiple +// sources (SymbolFile objects) to provide the information and only parse as +// deep as needed in order to provide the information that is requested. //---------------------------------------------------------------------- class SymbolVendor : public ModuleChild, public PluginInterface { public: Index: lldb/trunk/include/lldb/Symbol/Type.h =================================================================== --- lldb/trunk/include/lldb/Symbol/Type.h +++ lldb/trunk/include/lldb/Symbol/Type.h @@ -24,8 +24,8 @@ namespace lldb_private { //---------------------------------------------------------------------- -// CompilerContext allows an array of these items to be passed to -// perform detailed lookups in SymbolVendor and SymbolFile functions. +// CompilerContext allows an array of these items to be passed to perform +// detailed lookups in SymbolVendor and SymbolFile functions. //---------------------------------------------------------------------- struct CompilerContext { CompilerContext(CompilerContextKind t, const ConstString &n) @@ -82,16 +82,12 @@ eEncodingIsSyntheticUID } EncodingDataType; - // We must force the underlying type of the enum to be unsigned here. Not all - // compilers - // behave the same with regards to the default underlying type of an enum, but - // because - // this enum is used in an enum bitfield and integer comparisons are done with - // the value - // we need to guarantee that it's always unsigned so that, for example, - // eResolveStateFull - // doesn't compare less than eResolveStateUnresolved when used in a 2-bit - // bitfield. + // We must force the underlying type of the enum to be unsigned here. Not + // all compilers behave the same with regards to the default underlying type + // of an enum, but because this enum is used in an enum bitfield and integer + // comparisons are done with the value we need to guarantee that it's always + // unsigned so that, for example, eResolveStateFull doesn't compare less than + // eResolveStateUnresolved when used in a 2-bit bitfield. typedef enum ResolveStateTag : unsigned { eResolveStateUnresolved = 0, eResolveStateForward = 1, @@ -106,8 +102,7 @@ ResolveState compiler_type_resolve_state); // This makes an invalid type. Used for functions that return a Type when - // they - // get an error. + // they get an error. Type(); Type(const Type &rhs); @@ -119,7 +114,8 @@ void DumpTypeName(Stream *s); // Since Type instances only keep a "SymbolFile *" internally, other classes - // like TypeImpl need make sure the module is still around before playing with + // like TypeImpl need make sure the module is still around before playing + // with // Type instances. They can store a weak pointer to the Module; lldb::ModuleSP GetModule(); @@ -188,8 +184,8 @@ CompilerType GetFullCompilerType(); // Get the clang type, and resolve definitions enough so that the type could - // have layout performed. This allows ptrs and refs to class/struct/union/enum - // types remain forward declarations. + // have layout performed. This allows ptrs and refs to + // class/struct/union/enum types remain forward declarations. CompilerType GetLayoutCompilerType(); // Get the clang type and leave class/struct/union/enum types as forward @@ -198,8 +194,8 @@ static int Compare(const Type &a, const Type &b); - // From a fully qualified typename, split the type into the type basename - // and the remaining type scope (namespaces/classes). + // From a fully qualified typename, split the type into the type basename and + // the remaining type scope (namespaces/classes). static bool GetTypeScopeAndBasename(const llvm::StringRef& name, llvm::StringRef &scope, llvm::StringRef &basename, @@ -366,8 +362,8 @@ lldb::TypeSP type_sp; }; -// the two classes here are used by the public API as a backend to -// the SBType and SBTypeList classes +// the two classes here are used by the public API as a backend to the SBType +// and SBTypeList classes class TypeImpl { public: Index: lldb/trunk/include/lldb/Symbol/TypeSystem.h =================================================================== --- lldb/trunk/include/lldb/Symbol/TypeSystem.h +++ lldb/trunk/include/lldb/Symbol/TypeSystem.h @@ -66,8 +66,8 @@ // { // } // - // Then you can use the llvm casting on any "TypeSystem *" to get an - // instance of your subclass. + // Then you can use the llvm casting on any "TypeSystem *" to get an instance + // of your subclass. //---------------------------------------------------------------------- enum LLVMCastKind { eKindClang, @@ -94,8 +94,7 @@ Target *target); // Free up any resources associated with this TypeSystem. Done before - // removing - // all the TypeSystems from the TypeSystemMap. + // removing all the TypeSystems from the TypeSystemMap. virtual void Finalize() {} virtual DWARFASTParser *GetDWARFParser() { return nullptr; } @@ -239,8 +238,7 @@ virtual CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) = 0; // Returns -1 if this isn't a function of if the function doesn't have a - // prototype - // Returns a value >= 0 if there is a prototype. + // prototype Returns a value >= 0 if there is a prototype. virtual int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) = 0; virtual CompilerType @@ -332,8 +330,8 @@ bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) = 0; - // Lookup a child given a name. This function will match base class names - // and member member names in "clang_type" only, not descendants. + // Lookup a child given a name. This function will match base class names and + // member member names in "clang_type" only, not descendants. virtual uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) = 0; @@ -395,8 +393,8 @@ lldb::offset_t data_offset, size_t data_byte_size) = 0; - // Converts "s" to a floating point value and place resulting floating - // point bytes in the "dst" buffer. + // Converts "s" to a floating point value and place resulting floating point + // bytes in the "dst" buffer. virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) = 0; @@ -481,23 +479,17 @@ virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj); // Type systems can have types that are placeholder types, which are meant to - // indicate - // the presence of a type, but offer no actual information about said types, - // and leave - // the burden of actually figuring type information out to dynamic type - // resolution. For instance - // a language with a generics system, can use placeholder types to indicate - // "type argument goes here", - // without promising uniqueness of the placeholder, nor attaching any actually - // idenfiable information - // to said placeholder. This API allows type systems to tell LLDB when such a - // type has been encountered - // In response, the debugger can react by not using this type as a cache entry - // in any type-specific way - // For instance, LLDB will currently not cache any formatters that are - // discovered on such a type as - // attributable to the meaningless type itself, instead preferring to use the - // dynamic type + // indicate the presence of a type, but offer no actual information about + // said types, and leave the burden of actually figuring type information out + // to dynamic type resolution. For instance a language with a generics + // system, can use placeholder types to indicate "type argument goes here", + // without promising uniqueness of the placeholder, nor attaching any + // actually idenfiable information to said placeholder. This API allows type + // systems to tell LLDB when such a type has been encountered In response, + // the debugger can react by not using this type as a cache entry in any + // type-specific way For instance, LLDB will currently not cache any + // formatters that are discovered on such a type as attributable to the + // meaningless type itself, instead preferring to use the dynamic type virtual bool IsMeaninglessWithoutDynamicResolution(void *type); protected: @@ -514,8 +506,8 @@ // empties the map. void Clear(); - // Iterate through all of the type systems that are created. Return true - // from callback to keep iterating, false to stop iterating. + // Iterate through all of the type systems that are created. Return true from + // callback to keep iterating, false to stop iterating. void ForEach(std::function const &callback); TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language, Index: lldb/trunk/include/lldb/Symbol/UnwindPlan.h =================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindPlan.h +++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h @@ -25,28 +25,25 @@ namespace lldb_private { -// The UnwindPlan object specifies how to unwind out of a function - where -// this function saves the caller's register values before modifying them -// (for non-volatile aka saved registers) and how to find this frame's -// Canonical Frame Address (CFA). - -// Most commonly, registers are saved on the stack, offset some bytes from -// the Canonical Frame Address, or CFA, which is the starting address of -// this function's stack frame (the CFA is same as the eh_frame's CFA, -// whatever that may be on a given architecture). -// The CFA address for the stack frame does not change during -// the lifetime of the function. +// The UnwindPlan object specifies how to unwind out of a function - where this +// function saves the caller's register values before modifying them (for non- +// volatile aka saved registers) and how to find this frame's Canonical Frame +// Address (CFA). + +// Most commonly, registers are saved on the stack, offset some bytes from the +// Canonical Frame Address, or CFA, which is the starting address of this +// function's stack frame (the CFA is same as the eh_frame's CFA, whatever that +// may be on a given architecture). The CFA address for the stack frame does +// not change during the lifetime of the function. // Internally, the UnwindPlan is structured as a vector of register locations // organized by code address in the function, showing which registers have been -// saved at that point and where they are saved. -// It can be thought of as the expanded table form of the DWARF CFI -// encoded information. +// saved at that point and where they are saved. It can be thought of as the +// expanded table form of the DWARF CFI encoded information. // Other unwind information sources will be converted into UnwindPlans before -// being added to a FuncUnwinders object. The unwind source may be -// an eh_frame FDE, a DWARF debug_frame FDE, or assembly language based -// prologue analysis. +// being added to a FuncUnwinders object. The unwind source may be an eh_frame +// FDE, a DWARF debug_frame FDE, or assembly language based prologue analysis. // The UnwindPlan is the canonical form of this information that the unwinder // code will use when walking the stack. @@ -371,12 +368,10 @@ void InsertRow(const RowSP &row_sp, bool replace_existing = false); // Returns a pointer to the best row for the given offset into the function's - // instructions. - // If offset is -1 it indicates that the function start is unknown - the final - // row in the UnwindPlan is returned. - // In practice, the UnwindPlan for a function with no known start address will - // be the architectural default - // UnwindPlan which will only have one row. + // instructions. If offset is -1 it indicates that the function start is + // unknown - the final row in the UnwindPlan is returned. In practice, the + // UnwindPlan for a function with no known start address will be the + // architectural default UnwindPlan which will only have one row. UnwindPlan::RowSP GetRowForFunctionOffset(int offset) const; lldb::RegisterKind GetRegisterKind() const { return m_register_kind; } @@ -427,15 +422,13 @@ } // Is this UnwindPlan valid at all instructions? If not, then it is assumed - // valid at call sites, - // e.g. for exception handling. + // valid at call sites, e.g. for exception handling. lldb_private::LazyBool GetUnwindPlanValidAtAllInstructions() const { return m_plan_is_valid_at_all_instruction_locations; } // Is this UnwindPlan valid at all instructions? If not, then it is assumed - // valid at call sites, - // e.g. for exception handling. + // valid at call sites, e.g. for exception handling. void SetUnwindPlanValidAtAllInstructions( lldb_private::LazyBool valid_at_all_insn) { m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn; Index: lldb/trunk/include/lldb/Symbol/UnwindTable.h =================================================================== --- lldb/trunk/include/lldb/Symbol/UnwindTable.h +++ lldb/trunk/include/lldb/Symbol/UnwindTable.h @@ -18,8 +18,8 @@ namespace lldb_private { // A class which holds all the FuncUnwinders objects for a given ObjectFile. -// The UnwindTable is populated with FuncUnwinders objects lazily during -// the debug session. +// The UnwindTable is populated with FuncUnwinders objects lazily during the +// debug session. class UnwindTable { public: @@ -39,16 +39,13 @@ bool GetAllowAssemblyEmulationUnwindPlans(); // Normally when we create a new FuncUnwinders object we track it in this - // UnwindTable so it can - // be reused later. But for the target modules show-unwind we want to create - // brand new - // UnwindPlans for the function of interest - so ignore any existing - // FuncUnwinders for that - // function and don't add this new one to our UnwindTable. - // This FuncUnwinders object does have a reference to the UnwindTable but the - // lifetime of this - // uncached FuncUnwinders is expected to be short so in practice this will not - // be a problem. + // UnwindTable so it can be reused later. But for the target modules show- + // unwind we want to create brand new UnwindPlans for the function of + // interest - so ignore any existing FuncUnwinders for that function and + // don't add this new one to our UnwindTable. This FuncUnwinders object does + // have a reference to the UnwindTable but the lifetime of this uncached + // FuncUnwinders is expected to be short so in practice this will not be a + // problem. lldb::FuncUnwindersSP GetUncachedFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc); Index: lldb/trunk/include/lldb/Symbol/Variable.h =================================================================== --- lldb/trunk/include/lldb/Symbol/Variable.h +++ lldb/trunk/include/lldb/Symbol/Variable.h @@ -53,11 +53,11 @@ SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; } - // Since a variable can have a basename "i" and also a mangled - // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name - // "(anonymous namespace)::i", this function will allow a generic match - // function that can be called by commands and expression parsers to make - // sure we match anything we come across. + // Since a variable can have a basename "i" and also a mangled named + // "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous + // namespace)::i", this function will allow a generic match function that can + // be called by commands and expression parsers to make sure we match + // anything we come across. bool NameMatches(const ConstString &name) const; bool NameMatches(const RegularExpression ®ex) const; Index: lldb/trunk/include/lldb/Symbol/VariableList.h =================================================================== --- lldb/trunk/include/lldb/Symbol/VariableList.h +++ lldb/trunk/include/lldb/Symbol/VariableList.h @@ -50,11 +50,11 @@ size_t AppendVariablesIfUnique(VariableList &var_list); - // Returns the actual number of unique variables that were added to the - // list. "total_matches" will get updated with the actually number of - // matches that were found regardless of whether they were unique or not - // to allow for error conditions when nothing is found, versus conditions - // where any variables that match "regex" were already in "var_list". + // Returns the actual number of unique variables that were added to the list. + // "total_matches" will get updated with the actually number of matches that + // were found regardless of whether they were unique or not to allow for + // error conditions when nothing is found, versus conditions where any + // variables that match "regex" were already in "var_list". size_t AppendVariablesIfUnique(const RegularExpression ®ex, VariableList &var_list, size_t &total_matches); Index: lldb/trunk/include/lldb/Target/ABI.h =================================================================== --- lldb/trunk/include/lldb/Target/ABI.h +++ lldb/trunk/include/lldb/Target/ABI.h @@ -82,8 +82,7 @@ protected: // This is the method the ABI will call to actually calculate the return - // value. - // Don't put it in a persistent value object, that will be done by the + // value. Don't put it in a persistent value object, that will be done by the // ABI::GetReturnValueObject. virtual lldb::ValueObjectSP GetReturnValueObjectImpl(Thread &thread, CompilerType &ast_type) const = 0; @@ -118,17 +117,17 @@ // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed. // This function should return true if "cfa" is valid call frame address for // the ABI, and false otherwise. This is used by the generic stack frame - // unwinding - // code to help determine when a stack ends. + // unwinding code to help determine when a stack ends. virtual bool CallFrameAddressIsValid(lldb::addr_t cfa) = 0; - // Validates a possible PC value and returns true if an opcode can be at "pc". + // Validates a possible PC value and returns true if an opcode can be at + // "pc". virtual bool CodeAddressIsValid(lldb::addr_t pc) = 0; virtual lldb::addr_t FixCodeAddress(lldb::addr_t pc) { - // Some targets might use bits in a code address to indicate - // a mode switch. ARM uses bit zero to signify a code address is - // thumb, so any ARM ABI plug-ins would strip those bits. + // Some targets might use bits in a code address to indicate a mode switch. + // ARM uses bit zero to signify a code address is thumb, so any ARM ABI + // plug-ins would strip those bits. return pc; } Index: lldb/trunk/include/lldb/Target/DynamicLoader.h =================================================================== --- lldb/trunk/include/lldb/Target/DynamicLoader.h +++ lldb/trunk/include/lldb/Target/DynamicLoader.h @@ -356,8 +356,8 @@ // Return -1 if the read fails, otherwise return the result as an int64_t. int64_t ReadUnsignedIntWithSizeInBytes(lldb::addr_t addr, int size_in_bytes); - // Read a pointer from memory at the given addr. - // Return LLDB_INVALID_ADDRESS if the read fails. + // Read a pointer from memory at the given addr. Return LLDB_INVALID_ADDRESS + // if the read fails. lldb::addr_t ReadPointer(lldb::addr_t addr); // Calls into the Process protected method LoadOperatingSystemPlugin: Index: lldb/trunk/include/lldb/Target/ExecutionContext.h =================================================================== --- lldb/trunk/include/lldb/Target/ExecutionContext.h +++ lldb/trunk/include/lldb/Target/ExecutionContext.h @@ -384,8 +384,7 @@ bool thread_and_frame_only_if_stopped = false); // These two variants take in a locker, and grab the target, lock the API - // mutex into locker, then - // fill in the rest of the shared pointers. + // mutex into locker, then fill in the rest of the shared pointers. ExecutionContext(const ExecutionContextRef &exe_ctx_ref, std::unique_lock &locker); ExecutionContext(const ExecutionContextRef *exe_ctx_ref, @@ -616,36 +615,35 @@ //------------------------------------------------------------------ // Set the execution context using a target shared pointer. // - // If "target_sp" is valid, sets the target context to match and - // if "get_process" is true, sets the process shared pointer if - // the target currently has a process. + // If "target_sp" is valid, sets the target context to match and if + // "get_process" is true, sets the process shared pointer if the target + // currently has a process. //------------------------------------------------------------------ void SetContext(const lldb::TargetSP &target_sp, bool get_process); //------------------------------------------------------------------ // Set the execution context using a process shared pointer. // - // If "process_sp" is valid, then set the process and target in this - // context. Thread and frame contexts will be cleared. - // If "process_sp" is not valid, all shared pointers are reset. + // If "process_sp" is valid, then set the process and target in this context. + // Thread and frame contexts will be cleared. If "process_sp" is not valid, + // all shared pointers are reset. //------------------------------------------------------------------ void SetContext(const lldb::ProcessSP &process_sp); //------------------------------------------------------------------ // Set the execution context using a thread shared pointer. // - // If "thread_sp" is valid, then set the thread, process and target - // in this context. The frame context will be cleared. - // If "thread_sp" is not valid, all shared pointers are reset. + // If "thread_sp" is valid, then set the thread, process and target in this + // context. The frame context will be cleared. If "thread_sp" is not valid, + // all shared pointers are reset. //------------------------------------------------------------------ void SetContext(const lldb::ThreadSP &thread_sp); //------------------------------------------------------------------ // Set the execution context using a frame shared pointer. // - // If "frame_sp" is valid, then set the frame, thread, process and - // target in this context - // If "frame_sp" is not valid, all shared pointers are reset. + // If "frame_sp" is valid, then set the frame, thread, process and target in + // this context If "frame_sp" is not valid, all shared pointers are reset. //------------------------------------------------------------------ void SetContext(const lldb::StackFrameSP &frame_sp); Index: lldb/trunk/include/lldb/Target/Language.h =================================================================== --- lldb/trunk/include/lldb/Target/Language.h +++ lldb/trunk/include/lldb/Target/Language.h @@ -184,19 +184,16 @@ virtual const char *GetLanguageSpecificTypeLookupHelp(); // if an individual data formatter can apply to several types and cross a - // language boundary - // it makes sense for individual languages to want to customize the printing - // of values of that - // type by appending proper prefix/suffix information in language-specific - // ways + // language boundary it makes sense for individual languages to want to + // customize the printing of values of that type by appending proper + // prefix/suffix information in language-specific ways virtual bool GetFormatterPrefixSuffix(ValueObject &valobj, ConstString type_hint, std::string &prefix, std::string &suffix); // if a language has a custom format for printing variable declarations that - // it wants LLDB to honor - // it should return an appropriate closure here + // it wants LLDB to honor it should return an appropriate closure here virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper(); virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error); @@ -206,11 +203,9 @@ virtual bool IsNilReference(ValueObject &valobj); // for a ValueObject of some "reference type", if the language provides a - // technique - // to decide whether the reference has ever been assigned to some object, this - // method - // will return true if such detection is possible, and if the reference has - // never been assigned + // technique to decide whether the reference has ever been assigned to some + // object, this method will return true if such detection is possible, and if + // the reference has never been assigned virtual bool IsUninitializedReference(ValueObject &valobj); virtual bool GetFunctionDisplayName(const SymbolContext *sc, Index: lldb/trunk/include/lldb/Target/LanguageRuntime.h =================================================================== --- lldb/trunk/include/lldb/Target/LanguageRuntime.h +++ lldb/trunk/include/lldb/Target/LanguageRuntime.h @@ -85,26 +85,23 @@ Address &address, Value::ValueType &value_type) = 0; - // This call should return a CompilerType given a generic type name - // and an ExecutionContextScope in which one can actually fetch - // any specialization information required. + // This call should return a CompilerType given a generic type name and an + // ExecutionContextScope in which one can actually fetch any specialization + // information required. virtual CompilerType GetConcreteType(ExecutionContextScope *exe_scope, ConstString abstract_type_name) { return CompilerType(); } // This should be a fast test to determine whether it is likely that this - // value would - // have a dynamic type. + // value would have a dynamic type. virtual bool CouldHaveDynamicValue(ValueObject &in_value) = 0; // The contract for GetDynamicTypeAndAddress() is to return a "bare-bones" - // dynamic type - // For instance, given a Base* pointer, GetDynamicTypeAndAddress() will return - // the type of - // Derived, not Derived*. The job of this API is to correct this misalignment - // between the - // static type and the discovered dynamic type + // dynamic type For instance, given a Base* pointer, + // GetDynamicTypeAndAddress() will return the type of Derived, not Derived*. + // The job of this API is to correct this misalignment between the static + // type and the discovered dynamic type virtual TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) = 0; @@ -144,18 +141,16 @@ virtual void ModulesDidLoad(const ModuleList &module_list) {} - // Called by the Clang expression evaluation engine to allow runtimes to alter - // the set of target options provided to - // the compiler. - // If the options prototype is modified, runtimes must return true, false - // otherwise. + // Called by the Clang expression evaluation engine to allow runtimes to + // alter the set of target options provided to the compiler. If the options + // prototype is modified, runtimes must return true, false otherwise. virtual bool GetOverrideExprOptions(clang::TargetOptions &prototype) { return false; } // Called by ClangExpressionParser::PrepareForExecution to query for any - // custom LLVM IR passes - // that need to be run before an expression is assembled and run. + // custom LLVM IR passes that need to be run before an expression is + // assembled and run. virtual bool GetIRPasses(LLVMUserExpression::IRPasses &custom_passes) { return false; } Index: lldb/trunk/include/lldb/Target/Memory.h =================================================================== --- lldb/trunk/include/lldb/Target/Memory.h +++ lldb/trunk/include/lldb/Target/Memory.h @@ -120,8 +120,8 @@ //---------------------------------------------------------------------- // A class that can track allocated memory and give out allocated memory -// without us having to make an allocate/deallocate call every time we -// need some memory in a process that is being debugged. +// without us having to make an allocate/deallocate call every time we need +// some memory in a process that is being debugged. //---------------------------------------------------------------------- class AllocatedMemoryCache { public: Index: lldb/trunk/include/lldb/Target/MemoryRegionInfo.h =================================================================== --- lldb/trunk/include/lldb/Target/MemoryRegionInfo.h +++ lldb/trunk/include/lldb/Target/MemoryRegionInfo.h @@ -67,8 +67,8 @@ void SetBlocksize(lldb::offset_t blocksize) { m_blocksize = blocksize; } //---------------------------------------------------------------------- - // Get permissions as a uint32_t that is a mask of one or more bits from - // the lldb::Permissions + // Get permissions as a uint32_t that is a mask of one or more bits from the + // lldb::Permissions //---------------------------------------------------------------------- uint32_t GetLLDBPermissions() const { uint32_t permissions = 0; @@ -82,8 +82,8 @@ } //---------------------------------------------------------------------- - // Set permissions from a uint32_t that contains one or more bits from - // the lldb::Permissions + // Set permissions from a uint32_t that contains one or more bits from the + // lldb::Permissions //---------------------------------------------------------------------- void SetLLDBPermissions(uint32_t permissions) { m_read = (permissions & lldb::ePermissionsReadable) ? eYes : eNo; Index: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h =================================================================== --- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h +++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h @@ -48,10 +48,9 @@ class ClassDescriptor; typedef std::shared_ptr ClassDescriptorSP; - // the information that we want to support retrieving from an ObjC class - // this needs to be pure virtual since there are at least 2 different - // implementations - // of the runtime, and more might come + // the information that we want to support retrieving from an ObjC class this + // needs to be pure virtual since there are at least 2 different + // implementations of the runtime, and more might come class ClassDescriptor { public: ClassDescriptor() @@ -66,8 +65,8 @@ virtual ClassDescriptorSP GetMetaclass() const = 0; - // virtual if any implementation has some other version-specific rules - // but for the known v1/v2 this is all that needs to be done + // virtual if any implementation has some other version-specific rules but + // for the known v1/v2 this is all that needs to be done virtual bool IsKVO() { if (m_is_kvo == eLazyBoolCalculate) { const char *class_name = GetClassName().AsCString(); @@ -78,8 +77,8 @@ return (m_is_kvo == eLazyBoolYes); } - // virtual if any implementation has some other version-specific rules - // but for the known v1/v2 this is all that needs to be done + // virtual if any implementation has some other version-specific rules but + // for the known v1/v2 this is all that needs to be done virtual bool IsCFType() { if (m_is_cf == eLazyBoolCalculate) { const char *class_name = GetClassName().AsCString(); @@ -268,15 +267,14 @@ virtual DeclVendor *GetDeclVendor() { return nullptr; } // Finds the byte offset of the child_type ivar in parent_type. If it can't - // find the - // offset, returns LLDB_INVALID_IVAR_OFFSET. + // find the offset, returns LLDB_INVALID_IVAR_OFFSET. virtual size_t GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name); - // Given the name of an Objective-C runtime symbol (e.g., ivar offset symbol), - // try to determine from the runtime what the value of that symbol would be. - // Useful when the underlying binary is stripped. + // Given the name of an Objective-C runtime symbol (e.g., ivar offset + // symbol), try to determine from the runtime what the value of that symbol + // would be. Useful when the underlying binary is stripped. virtual lldb::addr_t LookupRuntimeSymbol(const ConstString &name) { return LLDB_INVALID_ADDRESS; } @@ -334,8 +332,7 @@ private: // We keep a map of ->Implementation so we don't have to call - // the resolver - // function over and over. + // the resolver function over and over. // FIXME: We need to watch for the loading of Protocols, and flush the cache // for any Index: lldb/trunk/include/lldb/Target/Platform.h =================================================================== --- lldb/trunk/include/lldb/Target/Platform.h +++ lldb/trunk/include/lldb/Target/Platform.h @@ -259,9 +259,9 @@ //------------------------------------------------------------------ // Subclasses must be able to fetch the current OS version // - // Remote classes must be connected for this to succeed. Local - // subclasses don't need to override this function as it will just - // call the HostInfo::GetOSVersion(). + // Remote classes must be connected for this to succeed. Local subclasses + // don't need to override this function as it will just call the + // HostInfo::GetOSVersion(). //------------------------------------------------------------------ virtual bool GetRemoteOSVersion() { return false; } @@ -322,8 +322,8 @@ //---------------------------------------------------------------------- // Locate the scripting resource given a module specification. // - // Locating the file should happen only on the local computer or using - // the current computers global settings. + // Locating the file should happen only on the local computer or using the + // current computers global settings. //---------------------------------------------------------------------- virtual FileSpecList LocateExecutableScriptingResources(Target *target, Module &module, @@ -467,8 +467,8 @@ // Status &error) = 0; //------------------------------------------------------------------ - // The base class Platform will take care of the host platform. - // Subclasses will need to fill in the remote case. + // The base class Platform will take care of the host platform. Subclasses + // will need to fill in the remote case. //------------------------------------------------------------------ virtual uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos); @@ -476,15 +476,15 @@ virtual bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info); //------------------------------------------------------------------ - // Set a breakpoint on all functions that can end up creating a thread - // for this platform. This is needed when running expressions and - // also for process control. + // Set a breakpoint on all functions that can end up creating a thread for + // this platform. This is needed when running expressions and also for + // process control. //------------------------------------------------------------------ virtual lldb::BreakpointSP SetThreadCreationBreakpoint(Target &target); //------------------------------------------------------------------ - // Given a target, find the local SDK directory if one exists on the - // current host. + // Given a target, find the local SDK directory if one exists on the current + // host. //------------------------------------------------------------------ virtual lldb_private::ConstString GetSDKDirectory(lldb_private::Target &target) { @@ -533,8 +533,8 @@ void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; } - // Override this to return true if your platform supports Clang modules. - // You may also need to override AddClangModuleCompilationOptions to pass the + // Override this to return true if your platform supports Clang modules. You + // may also need to override AddClangModuleCompilationOptions to pass the // right Clang flags for your platform. virtual bool SupportsModules() { return false; } @@ -549,9 +549,8 @@ bool SetWorkingDirectory(const FileSpec &working_dir); // There may be modules that we don't want to find by default for operations - // like "setting breakpoint by name". - // The platform will return "true" from this call if the passed in module - // happens to be one of these. + // like "setting breakpoint by name". The platform will return "true" from + // this call if the passed in module happens to be one of these. virtual bool ModuleIsExcludedForUnconstrainedSearches(Target &target, @@ -870,11 +869,11 @@ protected: bool m_is_host; - // Set to true when we are able to actually set the OS version while - // being connected. For remote platforms, we might set the version ahead - // of time before we actually connect and this version might change when - // we actually connect to a remote platform. For the host platform this - // will be set to the once we call HostInfo::GetOSVersion(). + // Set to true when we are able to actually set the OS version while being + // connected. For remote platforms, we might set the version ahead of time + // before we actually connect and this version might change when we actually + // connect to a remote platform. For the host platform this will be set to + // the once we call HostInfo::GetOSVersion(). bool m_os_version_set_while_connected; bool m_system_arch_set_while_connected; ConstString @@ -925,9 +924,8 @@ const char *GetCachedUserName(uint32_t uid) { std::lock_guard guard(m_mutex); - // return the empty string if our string is NULL - // so we can tell when things were in the negative - // cached (didn't find a valid user name, don't keep + // return the empty string if our string is NULL so we can tell when things + // were in the negative cached (didn't find a valid user name, don't keep // trying) const auto pos = m_uid_map.find(uid); return ((pos != m_uid_map.end()) ? pos->second.AsCString("") : nullptr); @@ -957,9 +955,8 @@ const char *GetCachedGroupName(uint32_t gid) { std::lock_guard guard(m_mutex); - // return the empty string if our string is NULL - // so we can tell when things were in the negative - // cached (didn't find a valid group name, don't keep + // return the empty string if our string is NULL so we can tell when things + // were in the negative cached (didn't find a valid group name, don't keep // trying) const auto pos = m_gid_map.find(gid); return ((pos != m_gid_map.end()) ? pos->second.AsCString("") : nullptr); Index: lldb/trunk/include/lldb/Target/Process.h =================================================================== --- lldb/trunk/include/lldb/Target/Process.h +++ lldb/trunk/include/lldb/Target/Process.h @@ -114,8 +114,8 @@ //---------------------------------------------------------------------- // ProcessInstanceInfo // -// Describes an existing process and any discoverable information that -// pertains to that process. +// Describes an existing process and any discoverable information that pertains +// to that process. //---------------------------------------------------------------------- class ProcessInstanceInfo : public ProcessInfo { public: @@ -279,7 +279,8 @@ class ProcessLaunchCommandOptions : public Options { public: ProcessLaunchCommandOptions() : Options() { - // Keep default values of all options in one place: OptionParsingStarting () + // Keep default values of all options in one place: OptionParsingStarting + // () OptionParsingStarting(nullptr); } @@ -389,10 +390,8 @@ }; // 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.) +// currently modify the program are running the program (which will up the +// StopID) and writing memory (which will up the MemoryID.) // FIXME: Should we also include modification of register states? class ProcessModID { @@ -540,12 +539,11 @@ enum Warnings { eWarningsOptimization = 1 }; typedef Range LoadRange; - // We use a read/write lock to allow on or more clients to - // access the process state while the process is stopped (reader). - // We lock the write lock to control access to the process - // while it is running (readers, or clients that want the process - // stopped can block waiting for the process to stop, or just - // try to lock it to see if they can immediately access the stopped + // We use a read/write lock to allow on or more clients to access the process + // state while the process is stopped (reader). We lock the write lock to + // control access to the process while it is running (readers, or clients + // that want the process stopped can block waiting for the process to stop, + // or just try to lock it to see if they can immediately access the stopped // process. If the try read lock fails, then the process is running. typedef ProcessRunLock::ProcessRunLocker StopLocker; @@ -810,18 +808,16 @@ //------------------------------------------------------------------ // FUTURE WORK: {Set,Get}LoadImageUtilityFunction are the first use we've // had of having other plugins cache data in the Process. This is handy for - // long-living plugins - like the Platform - which manage interactions whose - // lifetime is governed by the Process lifetime. If we find we need to do + // long-living plugins - like the Platform - which manage interactions whose + // lifetime is governed by the Process lifetime. If we find we need to do // this more often, we should construct a general solution to the problem. // The consensus suggestion was that we have a token based registry in the - // Process. - // Some undecided questions are - // (1) who manages the tokens. It's probably best that you add the element - // and get back a token that represents it. That will avoid collisions. But - // there may be some utility in the registerer controlling the token? - // (2) whether the thing added should be simply owned by Process, and - // just go away when it does - // (3) whether the registree should be notified of the Process' demise. + // Process. Some undecided questions are (1) who manages the tokens. It's + // probably best that you add the element and get back a token that + // represents it. That will avoid collisions. But there may be some utility + // in the registerer controlling the token? (2) whether the thing added + // should be simply owned by Process, and just go away when it does (3) + // whether the registree should be notified of the Process' demise. // // We are postponing designing this till we have at least a second use case. //------------------------------------------------------------------ @@ -1565,8 +1561,8 @@ //------------------------------------------------------------------ // Notify this process class that modules got loaded. // - // If subclasses override this method, they must call this version - // before doing anything in the subclass version of the function. + // If subclasses override this method, they must call this version before + // doing anything in the subclass version of the function. //------------------------------------------------------------------ virtual void ModulesDidLoad(ModuleList &module_list); @@ -1604,16 +1600,14 @@ } // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can - // return - // the full list of loaded shared libraries without needing any input. + // return the full list of loaded shared libraries without needing any input. virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos() { return StructuredData::ObjectSP(); } // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can - // return - // information about binaries given their load addresses. + // return information about binaries given their load addresses. virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos( const std::vector &load_addresses) { return StructuredData::ObjectSP(); @@ -1623,10 +1617,9 @@ // Get information about the library shared cache, if that exists // // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can - // return - // information about the library shared cache (a set of standard libraries - // that are - // loaded at the same location for all processes on a system) in use. + // return information about the library shared cache (a set of standard + // libraries that are loaded at the same location for all processes on a + // system) in use. //------------------------------------------------------------------ virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo() { return StructuredData::ObjectSP(); @@ -2371,9 +2364,9 @@ } // 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 - // doesn't work for a specific process plug-in. + // don't need to implement this function unless the standard flow of read + // existing opcode, write breakpoint opcode, verify breakpoint opcode doesn't + // work for a specific process plug-in. virtual Status EnableSoftwareBreakpoint(BreakpointSite *bp_site); // This is implemented completely using the lldb::Process API. Subclasses @@ -2397,8 +2390,8 @@ Status EnableBreakpointSiteByID(lldb::user_id_t break_id); - // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove - // themselves from the owner's list of this breakpoint sites. + // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove themselves + // from the owner's list of this breakpoint sites. void RemoveOwnerFromBreakpointSite(lldb::user_id_t owner_id, lldb::user_id_t owner_loc_id, lldb::BreakpointSiteSP &bp_site_sp); @@ -2420,11 +2413,10 @@ ThreadList &GetThreadList() { return m_thread_list; } - // When ExtendedBacktraces are requested, the HistoryThreads that are - // created need an owner -- they're saved here in the Process. The - // threads in this list are not iterated over - driver programs need to - // request the extended backtrace calls starting from a root concrete - // thread one by one. + // When ExtendedBacktraces are requested, the HistoryThreads that are created + // need an owner -- they're saved here in the Process. The threads in this + // list are not iterated over - driver programs need to request the extended + // backtrace calls starting from a root concrete thread one by one. ThreadList &GetExtendedThreadList() { return m_extended_thread_list; } ThreadList::ThreadIterable Threads() { return m_thread_list.Threads(); } @@ -2436,10 +2428,9 @@ // Returns true if an index id has been assigned to a thread. bool HasAssignedIndexIDToThread(uint64_t sb_thread_id); - // Given a thread_id, it will assign a more reasonable index id for display to - // the user. - // If the thread_id has previously been assigned, the same index id will be - // used. + // Given a thread_id, it will assign a more reasonable index id for display + // to the user. If the thread_id has previously been assigned, the same index + // id will be used. uint32_t AssignIndexIDToThread(uint64_t thread_id); //------------------------------------------------------------------ @@ -2464,13 +2455,11 @@ lldb::StateType GetNextEvent(lldb::EventSP &event_sp); // Returns the process state when it is stopped. If specified, event_sp_ptr - // is set to the event which triggered the stop. If wait_always = false, - // and the process is already stopped, this function returns immediately. - // If the process is hijacked and use_run_lock is true (the default), then - // this + // is set to the event which triggered the stop. If wait_always = false, and + // the process is already stopped, this function returns immediately. If the + // process is hijacked and use_run_lock is true (the default), then this // function releases the run lock after the stop. Setting use_run_lock to - // false - // will avoid this behavior. + // false will avoid this behavior. lldb::StateType WaitForProcessToStop(const Timeout &timeout, lldb::EventSP *event_sp_ptr = nullptr, @@ -2628,27 +2617,26 @@ void SetSTDIOFileDescriptor(int file_descriptor); //------------------------------------------------------------------ - // Add a permanent region of memory that should never be read or - // written to. This can be used to ensure that memory reads or writes - // to certain areas of memory never end up being sent to the - // DoReadMemory or DoWriteMemory functions which can improve - // performance. + // Add a permanent region of memory that should never be read or written to. + // This can be used to ensure that memory reads or writes to certain areas of + // memory never end up being sent to the DoReadMemory or DoWriteMemory + // functions which can improve performance. //------------------------------------------------------------------ void AddInvalidMemoryRegion(const LoadRange ®ion); //------------------------------------------------------------------ - // Remove a permanent region of memory that should never be read or - // written to that was previously added with AddInvalidMemoryRegion. + // Remove a permanent region of memory that should never be read or written + // to that was previously added with AddInvalidMemoryRegion. //------------------------------------------------------------------ bool RemoveInvalidMemoryRange(const LoadRange ®ion); //------------------------------------------------------------------ // If the setup code of a thread plan needs to do work that might involve - // calling a function in the target, it should not do that work directly - // in one of the thread plan functions (DidPush/WillResume) because - // such work needs to be handled carefully. Instead, put that work in - // a PreResumeAction callback, and register it with the process. It will - // get done before the actual "DoResume" gets called. + // calling a function in the target, it should not do that work directly in + // one of the thread plan functions (DidPush/WillResume) because such work + // needs to be handled carefully. Instead, put that work in a + // PreResumeAction callback, and register it with the process. It will get + // done before the actual "DoResume" gets called. //------------------------------------------------------------------ typedef bool(PreResumeActionCallback)(void *); @@ -2936,15 +2924,14 @@ 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 - // new "NextEventAction" is added while one is already present, the - // old action will be discarded (with HandleBeingUnshipped called - // after it is discarded.) + // 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 new "NextEventAction" is + // added while one is already present, the old action will be discarded (with + // HandleBeingUnshipped called after it is discarded.) // - // If you want to resume the process as a result of a resume action, - // call RequestResume, don't call Resume directly. + // If you want to resume the process as a result of a resume action, call + // RequestResume, don't call Resume directly. //------------------------------------------------------------------ class NextEventAction { public: @@ -3158,11 +3145,11 @@ bool m_currently_handling_do_on_removals; bool m_resume_requested; // If m_currently_handling_event or // m_currently_handling_do_on_removals are true, - // Resume will only request a resume, using this flag - // to check. + // Resume will only request a resume, using this + // flag to check. bool m_finalizing; // This is set at the beginning of Process::Finalize() to - // stop functions from looking up or creating things during - // a finalize call + // stop functions from looking up or creating things + // during a finalize call bool m_finalize_called; // This is set at the end of Process::Finalize() bool m_clear_thread_plans_on_stop; bool m_force_next_event_delivery; @@ -3213,12 +3200,9 @@ static lldb::thread_result_t PrivateStateThread(void *arg); // The starts up the private state thread that will watch for events from the - // debugee. - // Pass true for is_secondary_thread in the case where you have to temporarily - // spin up a - // secondary state thread to handle events from a hand-called function on the - // primary - // private state thread. + // debugee. Pass true for is_secondary_thread in the case where you have to + // temporarily spin up a secondary state thread to handle events from a hand- + // called function on the primary private state thread. lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread); @@ -3231,8 +3215,7 @@ const Timeout &timeout); // This waits for both the state change broadcaster, and the control - // broadcaster. - // If control_only, it only waits for the control broadcaster. + // broadcaster. If control_only, it only waits for the control broadcaster. bool GetEventsPrivate(lldb::EventSP &event_sp, const Timeout &timeout, bool control_only); Index: lldb/trunk/include/lldb/Target/ProcessInfo.h =================================================================== --- lldb/trunk/include/lldb/Target/ProcessInfo.h +++ lldb/trunk/include/lldb/Target/ProcessInfo.h @@ -21,9 +21,9 @@ // ProcessInfo // // A base class for information for a process. This can be used to fill -// out information for a process prior to launching it, or it can be -// used for an instance of a process and can be filled in with the -// existing values for that process. +// out information for a process prior to launching it, or it can be used for +// an instance of a process and can be filled in with the existing values for +// that process. //---------------------------------------------------------------------- class ProcessInfo { public: @@ -88,9 +88,8 @@ protected: FileSpec m_executable; std::string m_arg0; // argv[0] if supported. If empty, then use m_executable. - // Not all process plug-ins support specifying an argv[0] - // that differs from the resolved platform executable - // (which is in m_executable) + // Not all process plug-ins support specifying an argv[0] that differs from + // the resolved platform executable (which is in m_executable) Args m_arguments; // All program arguments except argv[0] Environment m_environment; uint32_t m_uid; Index: lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h =================================================================== --- lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h +++ lldb/trunk/include/lldb/Target/ProcessLaunchInfo.h @@ -110,10 +110,9 @@ bool GetMonitorSignals() const { return m_monitor_signals; } // If the LaunchInfo has a monitor callback, then arrange to monitor the - // process. - // Return true if the LaunchInfo has taken care of monitoring the process, and - // false if the - // caller might want to monitor the process themselves. + // process. Return true if the LaunchInfo has taken care of monitoring the + // process, and false if the caller might want to monitor the process + // themselves. bool MonitorProcess() const; Index: lldb/trunk/include/lldb/Target/Queue.h =================================================================== --- lldb/trunk/include/lldb/Target/Queue.h +++ lldb/trunk/include/lldb/Target/Queue.h @@ -22,15 +22,14 @@ //------------------------------------------------------------------ // Queue: -// This class represents a libdispatch aka Grand Central Dispatch -// queue in the process. +// This class represents a libdispatch aka Grand Central Dispatch queue in the +// process. // // A program using libdispatch will create queues, put work items -// (functions, blocks) on the queues. The system will create / -// reassign pthreads to execute the work items for the queues. A -// serial queue will be associated with a single thread (or possibly -// no thread, if it is not doing any work). A concurrent queue may -// be associated with multiple threads. +// (functions, blocks) on the queues. The system will create / reassign +// pthreads to execute the work items for the queues. A serial queue will be +// associated with a single thread (or possibly no thread, if it is not doing +// any work). A concurrent queue may be associated with multiple threads. //------------------------------------------------------------------ class Queue : public std::enable_shared_from_this { Index: lldb/trunk/include/lldb/Target/QueueItem.h =================================================================== --- lldb/trunk/include/lldb/Target/QueueItem.h +++ lldb/trunk/include/lldb/Target/QueueItem.h @@ -29,12 +29,11 @@ //------------------------------------------------------------------ // QueueItem: -// This class represents a work item enqueued on a libdispatch aka -// Grand Central Dispatch (GCD) queue. Most often, this will be a -// function or block. -// "enqueued" here means that the work item has been added to a queue -// but it has not yet started executing. When it is "dequeued", -// execution of the item begins. +// This class represents a work item enqueued on a libdispatch aka Grand +// Central Dispatch (GCD) queue. Most often, this will be a function or block. +// "enqueued" here means that the work item has been added to a queue but it +// has not yet started executing. When it is "dequeued", execution of the item +// begins. //------------------------------------------------------------------ class QueueItem : public std::enable_shared_from_this { Index: lldb/trunk/include/lldb/Target/QueueList.h =================================================================== --- lldb/trunk/include/lldb/Target/QueueList.h +++ lldb/trunk/include/lldb/Target/QueueList.h @@ -21,12 +21,11 @@ //------------------------------------------------------------------ // QueueList: -// This is the container for libdispatch aka Grand Central Dispatch -// Queue objects. +// This is the container for libdispatch aka Grand Central Dispatch Queue +// objects. // -// Each Process will have a QueueList. When the process execution is -// paused, the QueueList may be populated with Queues by the -// SystemRuntime. +// Each Process will have a QueueList. When the process execution is paused, +// the QueueList may be populated with Queues by the SystemRuntime. //------------------------------------------------------------------ class QueueList { Index: lldb/trunk/include/lldb/Target/RegisterCheckpoint.h =================================================================== --- lldb/trunk/include/lldb/Target/RegisterCheckpoint.h +++ lldb/trunk/include/lldb/Target/RegisterCheckpoint.h @@ -16,20 +16,19 @@ namespace lldb_private { -// Inherit from UserID in case pushing/popping all register values can be -// done using a 64 bit integer that holds a baton/cookie instead of actually -// having to read all register values into a buffer +// Inherit from UserID in case pushing/popping all register values can be done +// using a 64 bit integer that holds a baton/cookie instead of actually having +// to read all register values into a buffer class RegisterCheckpoint : public UserID { public: enum class Reason { // An expression is about to be run on the thread if the protocol that // talks to the debuggee supports checkpointing the registers using a - // push/pop then the UserID base class in the RegisterCheckpoint can - // be used to store the baton/cookie that refers to the remote saved - // state. + // push/pop then the UserID base class in the RegisterCheckpoint can be + // used to store the baton/cookie that refers to the remote saved state. eExpression, - // The register checkpoint wants the raw register bytes, so they must - // be read into m_data_sp, or the save/restore checkpoint should fail. + // The register checkpoint wants the raw register bytes, so they must be + // read into m_data_sp, or the save/restore checkpoint should fail. eDataBackup }; Index: lldb/trunk/include/lldb/Target/RegisterContext.h =================================================================== --- lldb/trunk/include/lldb/Target/RegisterContext.h +++ lldb/trunk/include/lldb/Target/RegisterContext.h @@ -63,16 +63,14 @@ } // These two functions are used to implement "push" and "pop" of register - // states. They are used primarily - // for expression evaluation, where we need to push a new state (storing the - // old one in data_sp) and then - // restoring the original state by passing the data_sp we got from - // ReadAllRegisters to WriteAllRegisterValues. - // ReadAllRegisters will do what is necessary to return a coherent set of - // register values for this thread, which - // may mean e.g. interrupting a thread that is sitting in a kernel trap. That - // is a somewhat disruptive operation, - // so these API's should only be used when this behavior is needed. + // states. They are used primarily for expression evaluation, where we need + // to push a new state (storing the old one in data_sp) and then restoring + // the original state by passing the data_sp we got from ReadAllRegisters to + // WriteAllRegisterValues. ReadAllRegisters will do what is necessary to + // return a coherent set of register values for this thread, which may mean + // e.g. interrupting a thread that is sitting in a kernel trap. That is a + // somewhat disruptive operation, so these API's should only be used when + // this behavior is needed. virtual bool ReadAllRegisterValues(lldb_private::RegisterCheckpoint ®_checkpoint); Index: lldb/trunk/include/lldb/Target/RegisterNumber.h =================================================================== --- lldb/trunk/include/lldb/Target/RegisterNumber.h +++ lldb/trunk/include/lldb/Target/RegisterNumber.h @@ -26,8 +26,8 @@ // This constructor plus the init() method below allow for the placeholder // creation of an invalid object initially, possibly to be filled in. It - // would be more consistent to have three Set* methods to set the three - // data that the object needs. + // would be more consistent to have three Set* methods to set the three data + // that the object needs. RegisterNumber(); void init(lldb_private::Thread &thread, lldb::RegisterKind kind, Index: lldb/trunk/include/lldb/Target/SectionLoadHistory.h =================================================================== --- lldb/trunk/include/lldb/Target/SectionLoadHistory.h +++ lldb/trunk/include/lldb/Target/SectionLoadHistory.h @@ -23,8 +23,8 @@ class SectionLoadHistory { public: enum : unsigned { - // Pass eStopIDNow to any function that takes a stop ID to get - // the current value. + // Pass eStopIDNow to any function that takes a stop ID to get the current + // value. eStopIDNow = UINT32_MAX }; //------------------------------------------------------------------ @@ -33,8 +33,8 @@ SectionLoadHistory() : m_stop_id_to_section_load_list(), m_mutex() {} ~SectionLoadHistory() { - // Call clear since this takes a lock and clears the section load list - // in case another thread is currently using this section load list + // Call clear since this takes a lock and clears the section load list in + // case another thread is currently using this section load list Clear(); } @@ -59,14 +59,14 @@ bool warn_multiple = false); // The old load address should be specified when unloading to ensure we get - // the correct instance of the section as a shared library could be loaded - // at more than one location. + // the correct instance of the section as a shared library could be loaded at + // more than one location. bool SetSectionUnloaded(uint32_t stop_id, const lldb::SectionSP §ion_sp, lldb::addr_t load_addr); // Unload all instances of a section. This function can be used on systems - // that don't support multiple copies of the same shared library to be - // loaded at the same time. + // that don't support multiple copies of the same shared library to be loaded + // at the same time. size_t SetSectionUnloaded(uint32_t stop_id, const lldb::SectionSP §ion_sp); Index: lldb/trunk/include/lldb/Target/SectionLoadList.h =================================================================== --- lldb/trunk/include/lldb/Target/SectionLoadList.h +++ lldb/trunk/include/lldb/Target/SectionLoadList.h @@ -34,8 +34,8 @@ SectionLoadList(const SectionLoadList &rhs); ~SectionLoadList() { - // Call clear since this takes a lock and clears the section load list - // in case another thread is currently using this section load list + // Call clear since this takes a lock and clears the section load list in + // case another thread is currently using this section load list Clear(); } @@ -55,14 +55,14 @@ bool warn_multiple = false); // The old load address should be specified when unloading to ensure we get - // the correct instance of the section as a shared library could be loaded - // at more than one location. + // the correct instance of the section as a shared library could be loaded at + // more than one location. bool SetSectionUnloaded(const lldb::SectionSP §ion_sp, lldb::addr_t load_addr); // Unload all instances of a section. This function can be used on systems - // that don't support multiple copies of the same shared library to be - // loaded at the same time. + // that don't support multiple copies of the same shared library to be loaded + // at the same time. size_t SetSectionUnloaded(const lldb::SectionSP §ion_sp); void Dump(Stream &s, Target *target); Index: lldb/trunk/include/lldb/Target/StackFrame.h =================================================================== --- lldb/trunk/include/lldb/Target/StackFrame.h +++ lldb/trunk/include/lldb/Target/StackFrame.h @@ -469,8 +469,7 @@ lldb::LanguageType GetLanguage(); // similar to GetLanguage(), but is allowed to take a potentially incorrect - // guess - // if exact information is not available + // guess if exact information is not available lldb::LanguageType GuessLanguage(); //------------------------------------------------------------------ Index: lldb/trunk/include/lldb/Target/StackID.h =================================================================== --- lldb/trunk/include/lldb/Target/StackID.h +++ lldb/trunk/include/lldb/Target/StackID.h @@ -81,20 +81,20 @@ lldb::addr_t m_pc; // The pc value for the function/symbol for this frame. This will // only get used if the symbol scope is nullptr (the code where we are - // stopped is not represented by any function or symbol in any - // shared library). + // stopped is not represented by any function or symbol in any shared + // library). lldb::addr_t m_cfa; // The call frame address (stack pointer) value // at the beginning of the function that uniquely - // identifies this frame (along with m_symbol_scope below) + // identifies this frame (along with m_symbol_scope + // below) SymbolContextScope * m_symbol_scope; // If nullptr, there is no block or symbol for this frame. // If not nullptr, this will either be the scope for the - // lexical block for the frame, or the scope - // for the symbol. Symbol context scopes are - // always be unique pointers since the are part - // of the Block and Symbol objects and can easily - // be used to tell if a stack ID is the same as - // another. + // lexical block for the frame, or the scope for the + // symbol. Symbol context scopes are always be unique + // pointers since the are part of the Block and Symbol + // objects and can easily be used to tell if a stack ID + // is the same as another. }; bool operator==(const StackID &lhs, const StackID &rhs); Index: lldb/trunk/include/lldb/Target/StopInfo.h =================================================================== --- lldb/trunk/include/lldb/Target/StopInfo.h +++ lldb/trunk/include/lldb/Target/StopInfo.h @@ -40,12 +40,10 @@ lldb::ThreadSP GetThread() const { return m_thread_wp.lock(); } - // The value of the StopInfo depends on the StopReason. - // StopReason Meaning - // ---------------------------------------------- - // eStopReasonBreakpoint BreakpointSiteID - // eStopReasonSignal Signal number - // eStopReasonWatchpoint WatchpointLocationID + // The value of the StopInfo depends on the StopReason. StopReason + // Meaning ---------------------------------------------- + // eStopReasonBreakpoint BreakpointSiteID eStopReasonSignal + // Signal number eStopReasonWatchpoint WatchpointLocationID // eStopReasonPlanComplete No significance uint64_t GetValue() const { return m_value; } @@ -53,10 +51,8 @@ virtual lldb::StopReason GetStopReason() const = 0; // ShouldStopSynchronous will get called before any thread plans are - // consulted, and if it says we should - // resume the target, then we will just immediately resume. This should not - // run any code in or resume the - // target. + // consulted, and if it says we should resume the target, then we will just + // immediately resume. This should not run any code in or resume the target. virtual bool ShouldStopSynchronous(Event *event_ptr) { return true; } @@ -88,14 +84,11 @@ virtual bool IsValidForOperatingSystemThread(Thread &thread) { return true; } // Sometimes the thread plan logic will know that it wants a given stop to - // stop or not, - // regardless of what the ordinary logic for that StopInfo would dictate. The - // main example - // of this is the ThreadPlanCallFunction, which for instance knows - based on - // how that particular - // expression was executed - whether it wants all breakpoints to auto-continue - // or not. - // Use OverrideShouldStop on the StopInfo to implement this. + // stop or not, regardless of what the ordinary logic for that StopInfo would + // dictate. The main example of this is the ThreadPlanCallFunction, which + // for instance knows - based on how that particular expression was executed + // - whether it wants all breakpoints to auto-continue or not. Use + // OverrideShouldStop on the StopInfo to implement this. void OverrideShouldStop(bool override_value) { m_override_should_stop = override_value ? eLazyBoolYes : eLazyBoolNo; @@ -159,15 +152,13 @@ virtual bool DoShouldNotify(Event *event_ptr) { return false; } - // Stop the thread by default. Subclasses can override this to allow - // the thread to continue if desired. The ShouldStop method should not do - // anything - // that might run code. If you need to run code when deciding whether to stop - // at this StopInfo, that must be done in the PerformAction. + // Stop the thread by default. Subclasses can override this to allow the + // thread to continue if desired. The ShouldStop method should not do + // anything that might run code. If you need to run code when deciding + // whether to stop at this StopInfo, that must be done in the PerformAction. // The PerformAction will always get called before the ShouldStop. This is - // done by the - // ProcessEventData::DoOnRemoval, though the ThreadPlanBase needs to consult - // this later on. + // done by the ProcessEventData::DoOnRemoval, though the ThreadPlanBase needs + // to consult this later on. virtual bool ShouldStop(Event *event_ptr) { return true; } //------------------------------------------------------------------ @@ -185,14 +176,13 @@ StructuredData::ObjectSP m_extended_info; // The extended info for this stop info - // This determines whether the target has run since this stop info. - // N.B. running to evaluate a user expression does not count. + // This determines whether the target has run since this stop info. N.B. + // running to evaluate a user expression does not count. bool HasTargetRunSinceMe(); // MakeStopInfoValid is necessary to allow saved stop infos to resurrect - // themselves as valid. - // It should only be used by Thread::RestoreThreadStateFromCheckpoint and to - // make sure the one-step + // themselves as valid. It should only be used by + // Thread::RestoreThreadStateFromCheckpoint and to make sure the one-step // needed for before-the-fact watchpoints does not prevent us from stopping void MakeStopInfoValid(); Index: lldb/trunk/include/lldb/Target/Target.h =================================================================== --- lldb/trunk/include/lldb/Target/Target.h +++ lldb/trunk/include/lldb/Target/Target.h @@ -232,8 +232,8 @@ public: // MSVC has a bug here that reports C4268: 'const' static/global data // initialized with compiler generated default constructor fills the object -// with zeros. -// Confirmed that MSVC is *not* zero-initializing, it's just a bogus warning. +// with zeros. Confirmed that MSVC is *not* zero-initializing, it's just a +// bogus warning. #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable : 4268) @@ -350,8 +350,7 @@ } // Allows the expression contents to be remapped to point to the specified - // file and line - // using #line directives. + // file and line using #line directives. void SetPoundLine(const char *path, uint32_t line) const { if (path && path[0]) { m_pound_line_file = path; @@ -398,8 +397,8 @@ Timeout m_one_thread_timeout = llvm::None; lldb::ExpressionCancelCallback m_cancel_callback = nullptr; void *m_cancel_callback_baton = nullptr; - // If m_pound_line_file is not empty and m_pound_line_line is non-zero, - // use #line %u "%s" before the expression content to remap where the source + // If m_pound_line_file is not empty and m_pound_line_line is non-zero, use + // #line %u "%s" before the expression content to remap where the source // originates mutable std::string m_pound_line_file; mutable uint32_t m_pound_line_line; @@ -557,9 +556,8 @@ LazyBool move_to_nearest_code); // Use this to create breakpoint that matches regex against the source lines - // in files given in source_file_list: - // If function_names is non-empty, also filter by function after the matches - // are made. + // in files given in source_file_list: If function_names is non-empty, also + // filter by function after the matches are made. lldb::BreakpointSP CreateSourceRegexBreakpoint( const FileSpecList *containingModules, const FileSpecList *source_file_list, @@ -583,8 +581,8 @@ // 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 + // When "skip_prologue is set to eLazyBoolCalculate, we use the current + // target setting, else we use the values passed in lldb::BreakpointSP CreateFuncRegexBreakpoint( const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, RegularExpression &func_regexp, @@ -592,10 +590,10 @@ bool internal, bool request_hardware); // 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. + // 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. lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, const char *func_name, @@ -612,11 +610,10 @@ Status *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 - // you already know. - // func_name_type_mask is or'ed values from the FunctionNameType enum. + // 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 you + // already know. func_name_type_mask is or'ed values from the + // FunctionNameType enum. lldb::BreakpointSP CreateBreakpoint(const FileSpecList *containingModules, const FileSpecList *containingSourceFiles, @@ -760,13 +757,11 @@ lldb::addr_t load_addr, lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const; - // Get load_addr as breakable load address for this target. - // Take a addr and check if for any reason there is a better address than this - // to put a breakpoint on. - // If there is then return that address. - // For MIPS, if instruction at addr is a delay slot instruction then this - // method will find the address of its - // previous instruction and return that address. + // Get load_addr as breakable load address for this target. Take a addr and + // check if for any reason there is a better address than this to put a + // breakpoint on. If there is then return that address. For MIPS, if + // instruction at addr is a delay slot instruction then this method will find + // the address of its previous instruction and return that address. lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr); void ModulesDidLoad(ModuleList &module_list); @@ -951,12 +946,12 @@ Status &error); // Reading memory through the target allows us to skip going to the process - // for reading memory if possible and it allows us to try and read from - // any constant sections in our object files on disk. If you always want - // live program memory, read straight from the process. If you possibly - // want to read from const sections in object files, read from the target. - // This version of ReadMemory will try and read memory from the process - // if the process is alive. The order is: + // for reading memory if possible and it allows us to try and read from any + // constant sections in our object files on disk. If you always want live + // program memory, read straight from the process. If you possibly want to + // read from const sections in object files, read from the target. This + // version of ReadMemory will try and read memory from the process if the + // process is alive. The order is: // 1 - if (prefer_file_cache == true) then read from object file cache // 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 @@ -1012,9 +1007,8 @@ PersistentExpressionState * GetPersistentExpressionStateForLanguage(lldb::LanguageType language); - // Creates a UserExpression for the given language, the rest of the parameters - // have the - // same meaning as for the UserExpression constructor. + // Creates a UserExpression for the given language, the rest of the + // parameters have the same meaning as for the UserExpression constructor. // Returns a new-ed object which the caller owns. UserExpression *GetUserExpressionForLanguage( @@ -1022,10 +1016,9 @@ Expression::ResultType desired_type, const EvaluateExpressionOptions &options, Status &error); - // Creates a FunctionCaller for the given language, the rest of the parameters - // have the - // same meaning as for the FunctionCaller constructor. Since a FunctionCaller - // can't be + // Creates a FunctionCaller for the given language, the rest of the + // parameters have the same meaning as for the FunctionCaller constructor. + // Since a FunctionCaller can't be // IR Interpreted, it makes no sense to call this with an // ExecutionContextScope that lacks // a Process. @@ -1038,8 +1031,7 @@ const char *name, Status &error); // Creates a UtilityFunction for the given language, the rest of the - // parameters have the - // same meaning as for the UtilityFunction constructor. + // parameters have the same meaning as for the UtilityFunction constructor. // Returns a new-ed object which the caller owns. UtilityFunction *GetUtilityFunctionForLanguage(const char *expr, @@ -1052,8 +1044,8 @@ lldb::ClangASTImporterSP GetClangASTImporter(); //---------------------------------------------------------------------- - // Install any files through the platform that need be to installed - // prior to launching or attaching. + // Install any files through the platform that need be to installed prior to + // launching or attaching. //---------------------------------------------------------------------- Status Install(ProcessLaunchInfo *launch_info); @@ -1078,10 +1070,10 @@ void ClearAllLoadedSections(); // Since expressions results can persist beyond the lifetime of a process, - // and the const expression results are available after a process is gone, - // we provide a way for expressions to be evaluated from the Target itself. - // If an expression is going to be run, then it should have a frame filled - // in in th execution context. + // and the const expression results are available after a process is gone, we + // provide a way for expressions to be evaluated from the Target itself. If + // an expression is going to be run, then it should have a frame filled in in + // th execution context. lldb::ExpressionResults EvaluateExpression( llvm::StringRef expression, ExecutionContextScope *exe_scope, lldb::ValueObjectSP &result_valobj_sp, @@ -1135,17 +1127,15 @@ bool m_active; // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer - // and fill it with commands, - // and SetSpecifier to set the specifier shared pointer (can be null, that - // will match anything.) + // and fill it with commands, and SetSpecifier to set the specifier shared + // pointer (can be null, that will match anything.) StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid); friend class Target; }; typedef std::shared_ptr StopHookSP; - // Add an empty stop hook to the Target's stop hook list, and returns a shared - // pointer to it in new_hook. - // Returns the id of the new hook. + // Add an empty stop hook to the Target's stop hook list, and returns a + // shared pointer to it in new_hook. Returns the id of the new hook. StopHookSP CreateStopHook(); void RunStopHooks(); @@ -1259,9 +1249,9 @@ lldb::BreakpointSP m_last_created_breakpoint; WatchpointList m_watchpoint_list; lldb::WatchpointSP m_last_created_watchpoint; - // We want to tightly control the process destruction process so - // we can correctly tear down everything that we need to, so the only - // class that knows about the process lifespan is this target class. + // We want to tightly control the process destruction process so we can + // correctly tear down everything that we need to, so the only class that + // knows about the process lifespan is this target class. lldb::ProcessSP m_process_sp; lldb::SearchFilterSP m_search_filter_sp; PathMappingList m_image_search_paths; Index: lldb/trunk/include/lldb/Target/Thread.h =================================================================== --- lldb/trunk/include/lldb/Target/Thread.h +++ lldb/trunk/include/lldb/Target/Thread.h @@ -214,8 +214,8 @@ // This function is called on all the threads before "ShouldResume" and // "WillResume" in case a thread needs to change its state before the - // ThreadList polls all the threads to figure out which ones actually - // will get to run and how. + // ThreadList polls all the threads to figure out which ones actually will + // get to run and how. void SetupForResume(); // Do not override this function, it is for thread plan logic only @@ -224,8 +224,8 @@ // Override this to do platform specific tasks before resume. virtual void WillResume(lldb::StateType resume_state) {} - // This clears generic thread state after a resume. If you subclass this, - // be sure to call it. + // This clears generic thread state after a resume. If you subclass this, be + // sure to call it. virtual void DidResume(); // This notifies the thread when a private stop occurs. @@ -244,14 +244,10 @@ void Flush(); // Return whether this thread matches the specification in ThreadSpec. This - // is a virtual - // method because at some point we may extend the thread spec with a platform - // specific - // dictionary of attributes, which then only the platform specific Thread - // implementation - // would know how to match. For now, this just calls through to the - // ThreadSpec's - // ThreadPassesBasicTests method. + // is a virtual method because at some point we may extend the thread spec + // with a platform specific dictionary of attributes, which then only the + // platform specific Thread implementation would know how to match. For now, + // this just calls through to the ThreadSpec's ThreadPassesBasicTests method. virtual bool MatchesSpec(const ThreadSpec *spec); lldb::StopInfoSP GetStopInfo(); @@ -261,9 +257,8 @@ bool StopInfoIsUpToDate() const; // This sets the stop reason to a "blank" stop reason, so you can call - // functions on the thread - // without having the called function run with whatever stop reason you - // stopped with. + // functions on the thread without having the called function run with + // whatever stop reason you stopped with. void SetStopInfoToNothing(); bool ThreadStoppedForAReason(); @@ -492,16 +487,15 @@ virtual void ClearBackingThread() { // Subclasses can use this function if a thread is actually backed by // another thread. This is currently used for the OperatingSystem plug-ins - // where they might have a thread that is in memory, yet its registers - // are available through the lldb_private::Thread subclass for the current + // where they might have a thread that is in memory, yet its registers are + // available through the lldb_private::Thread subclass for the current // lldb_private::Process class. Since each time the process stops the - // backing - // threads for memory threads can change, we need a way to clear the backing - // thread for all memory threads each time we stop. + // backing threads for memory threads can change, we need a way to clear + // the backing thread for all memory threads each time we stop. } - // If stop_format is true, this will be the form used when we print stop info. - // If false, it will be the form we use for thread list and co. + // If stop_format is true, this will be the form used when we print stop + // info. If false, it will be the form we use for thread list and co. void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, bool stop_format); @@ -607,30 +601,24 @@ // Thread Plan Providers: // This section provides the basic thread plans that the Process control // machinery uses to run the target. ThreadPlan.h provides more details on - // how this mechanism works. - // The thread provides accessors to a set of plans that perform basic - // operations. - // The idea is that particular Platform plugins can override these methods to - // provide the implementation of these basic operations appropriate to their - // environment. + // how this mechanism works. The thread provides accessors to a set of plans + // that perform basic operations. The idea is that particular Platform + // plugins can override these methods to provide the implementation of these + // basic operations appropriate to their environment. // // NB: All the QueueThreadPlanXXX providers return Shared Pointers to // Thread plans. This is useful so that you can modify the plans after // creation in ways specific to that plan type. Also, it is often necessary - // for - // ThreadPlans that utilize other ThreadPlans to implement their task to keep - // a shared - // pointer to the sub-plan. - // But besides that, the shared pointers should only be held onto by entities - // who live no longer - // than the thread containing the ThreadPlan. + // for ThreadPlans that utilize other ThreadPlans to implement their task to + // keep a shared pointer to the sub-plan. But besides that, the shared + // pointers should only be held onto by entities who live no longer than the + // thread containing the ThreadPlan. // FIXME: If this becomes a problem, we can make a version that just returns a // pointer, // which it is clearly unsafe to hold onto, and a shared pointer version, and - // only allow - // ThreadPlan and Co. to use the latter. That is made more annoying to do - // because there's - // no elegant way to friend a method to all sub-classes of a given class. + // only allow ThreadPlan and Co. to use the latter. That is made more + // annoying to do because there's no elegant way to friend a method to all + // sub-classes of a given class. // //------------------------------------------------------------------ @@ -717,9 +705,8 @@ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); // Helper function that takes a LineEntry to step, insted of an AddressRange. - // This may combine multiple - // LineEntries of the same source line number to step over a longer address - // range in a single operation. + // This may combine multiple LineEntries of the same source line number to + // step over a longer address range in a single operation. virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange( bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, @@ -779,9 +766,8 @@ LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); // Helper function that takes a LineEntry to step, insted of an AddressRange. - // This may combine multiple - // LineEntries of the same source line number to step over a longer address - // range in a single operation. + // This may combine multiple LineEntries of the same source line number to + // step over a longer address range in a single operation. virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange( bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, const char *step_in_target, @@ -1115,23 +1101,22 @@ void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp); //------------------------------------------------------------------ - // Get the thread index ID. The index ID that is guaranteed to not - // be re-used by a process. They start at 1 and increase with each - // new thread. This allows easy command line access by a unique ID - // that is easier to type than the actual system thread ID. + // Get the thread index ID. The index ID that is guaranteed to not be re-used + // by a process. They start at 1 and increase with each new thread. This + // allows easy command line access by a unique ID that is easier to type than + // the actual system thread ID. //------------------------------------------------------------------ uint32_t GetIndexID() const; //------------------------------------------------------------------ // Get the originating thread's index ID. - // In the case of an "extended" thread -- a thread which represents - // the stack that enqueued/spawned work that is currently executing -- - // we need to provide the IndexID of the thread that actually did - // this work. We don't want to just masquerade as that thread's IndexID - // by using it in our own IndexID because that way leads to madness - - // but the driver program which is iterating over extended threads - // may ask for the OriginatingThreadID to display that information - // to the user. + // In the case of an "extended" thread -- a thread which represents the stack + // that enqueued/spawned work that is currently executing -- we need to + // provide the IndexID of the thread that actually did this work. We don't + // want to just masquerade as that thread's IndexID by using it in our own + // IndexID because that way leads to madness - but the driver program which + // is iterating over extended threads may ask for the OriginatingThreadID to + // display that information to the user. // Normal threads will return the same thing as GetIndexID(); //------------------------------------------------------------------ virtual uint32_t GetExtendedBacktraceOriginatingIndexID() { @@ -1139,10 +1124,10 @@ } //------------------------------------------------------------------ - // The API ID is often the same as the Thread::GetID(), but not in - // all cases. Thread::GetID() is the user visible thread ID that - // clients would want to see. The API thread ID is the thread ID - // that is used when sending data to/from the debugging protocol. + // The API ID is often the same as the Thread::GetID(), but not in all cases. + // Thread::GetID() is the user visible thread ID that clients would want to + // see. The API thread ID is the thread ID that is used when sending data + // to/from the debugging protocol. //------------------------------------------------------------------ virtual lldb::user_id_t GetProtocolID() const { return GetID(); } @@ -1171,9 +1156,9 @@ uint32_t num_frames_with_source); // We need a way to verify that even though we have a thread in a shared - // pointer that the object itself is still valid. Currently this won't be - // the case if DestroyThread() was called. DestroyThread is called when - // a thread has been removed from the Process' thread list. + // pointer that the object itself is still valid. Currently this won't be the + // case if DestroyThread() was called. DestroyThread is called when a thread + // has been removed from the Process' thread list. bool IsValid() const { return !m_destroy_called; } // Sets and returns a valid stop info based on the process stop ID and the @@ -1194,8 +1179,8 @@ //---------------------------------------------------------------------- // Ask the thread subclass to set its stop info. // - // Thread subclasses should call Thread::SetStopInfo(...) with the - // reason the thread stopped. + // Thread subclasses should call Thread::SetStopInfo(...) with the reason the + // thread stopped. // // @return // True if Thread::SetStopInfo(...) was called, false otherwise. @@ -1206,10 +1191,10 @@ // Gets the temporary resume state for a thread. // // This value gets set in each thread by complex debugger logic in - // Thread::ShouldResume() and an appropriate thread resume state will get - // set in each thread every time the process is resumed prior to calling - // Process::DoResume(). The lldb_private::Process subclass should adhere - // to the thread resume state request which will be one of: + // Thread::ShouldResume() and an appropriate thread resume state will get set + // in each thread every time the process is resumed prior to calling + // Process::DoResume(). The lldb_private::Process subclass should adhere to + // the thread resume state request which will be one of: // // eStateRunning - thread will resume when process is resumed // eStateStepping - thread should step 1 instruction and stop when process @@ -1257,10 +1242,9 @@ friend class StackFrame; friend class OperatingSystem; - // This is necessary to make sure thread assets get destroyed while the thread - // is still in good shape - // to call virtual thread methods. This must be called by classes that derive - // from Thread in their destructor. + // This is necessary to make sure thread assets get destroyed while the + // thread is still in good shape to call virtual thread methods. This must + // be called by classes that derive from Thread in their destructor. virtual void DestroyThread(); void PushPlan(lldb::ThreadPlanSP &plan_sp); @@ -1286,8 +1270,7 @@ virtual bool IsOperatingSystemPluginThread() const { return false; } // Subclasses that have a way to get an extended info dictionary for this - // thread should - // fill + // thread should fill virtual lldb_private::StructuredData::ObjectSP FetchThreadExtendedInfo() { return StructuredData::ObjectSP(); } @@ -1307,7 +1290,8 @@ lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is // valid. Can use this so you know that - // the thread's m_stop_info_sp is current and you don't have to fetch it again + // the thread's m_stop_info_sp is current and you don't have to fetch it + // again uint32_t m_stop_info_override_stop_id; // The stop ID containing the last time // the stop info was checked against // the stop info override Index: lldb/trunk/include/lldb/Target/ThreadCollection.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadCollection.h +++ lldb/trunk/include/lldb/Target/ThreadCollection.h @@ -39,9 +39,9 @@ void InsertThread(const lldb::ThreadSP &thread_sp, uint32_t idx); - // Note that "idx" is not the same as the "thread_index". It is a zero - // based index to accessing the current threads, whereas "thread_index" - // is a unique index assigned + // Note that "idx" is not the same as the "thread_index". It is a zero based + // index to accessing the current threads, whereas "thread_index" is a unique + // index assigned lldb::ThreadSP GetThreadAtIndex(uint32_t idx); virtual ThreadIterable Threads() { Index: lldb/trunk/include/lldb/Target/ThreadList.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadList.h +++ lldb/trunk/include/lldb/Target/ThreadList.h @@ -43,9 +43,8 @@ lldb::ThreadSP GetSelectedThread(); // Manage the thread to use for running expressions. This is usually the - // Selected thread, - // but sometimes (e.g. when evaluating breakpoint conditions & stop hooks) it - // isn't. + // Selected thread, but sometimes (e.g. when evaluating breakpoint conditions + // & stop hooks) it isn't. class ExpressionExecutionThreadPusher { public: ExpressionExecutionThreadPusher(ThreadList &thread_list, lldb::tid_t tid) @@ -83,9 +82,9 @@ void Destroy(); - // Note that "idx" is not the same as the "thread_index". It is a zero - // based index to accessing the current threads, whereas "thread_index" - // is a unique index assigned + // Note that "idx" is not the same as the "thread_index". It is a zero based + // index to accessing the current threads, whereas "thread_index" is a unique + // index assigned lldb::ThreadSP GetThreadAtIndex(uint32_t idx, bool can_update = true); lldb::ThreadSP FindThreadByID(lldb::tid_t tid, bool can_update = true); Index: lldb/trunk/include/lldb/Target/ThreadPlan.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlan.h +++ lldb/trunk/include/lldb/Target/ThreadPlan.h @@ -340,9 +340,8 @@ public: typedef enum { eAllThreads, eSomeThreads, eThisThread } ThreadScope; - // We use these enums so that we can cast a base thread plan to it's real type - // without having to resort - // to dynamic casting. + // We use these enums so that we can cast a base thread plan to it's real + // type without having to resort to dynamic casting. typedef enum { eKindGeneric, eKindNull, @@ -432,9 +431,8 @@ virtual bool ShouldAutoContinue(Event *event_ptr) { return false; } - // Whether a "stop class" event should be reported to the "outside world". In - // general - // if a thread plan is active, events should not be reported. + // Whether a "stop class" event should be reported to the "outside world". + // In general if a thread plan is active, events should not be reported. virtual Vote ShouldReportStop(Event *event_ptr); @@ -445,8 +443,7 @@ virtual bool StopOthers(); // This is the wrapper for DoWillResume that does generic ThreadPlan logic, - // then - // calls DoWillResume. + // then calls DoWillResume. bool WillResume(lldb::StateType resume_state, bool current_plan); virtual bool WillStop() = 0; @@ -468,8 +465,8 @@ virtual bool MischiefManaged(); virtual void ThreadDestroyed() { - // Any cleanup that a plan might want to do in case the thread goes away - // in the middle of the plan being queued on a thread can be done here. + // Any cleanup that a plan might want to do in case the thread goes away in + // the middle of the plan being queued on a thread can be done here. } bool GetPrivate() { return m_plan_private; } @@ -509,39 +506,35 @@ } // Some thread plans hide away the actual stop info which caused any - // particular stop. For - // instance the ThreadPlanCallFunction restores the original stop reason so - // that stopping and - // calling a few functions won't lose the history of the run. - // This call can be implemented to get you back to the real stop info. + // particular stop. For instance the ThreadPlanCallFunction restores the + // original stop reason so that stopping and calling a few functions won't + // lose the history of the run. This call can be implemented to get you back + // to the real stop info. virtual lldb::StopInfoSP GetRealStopInfo() { return m_thread.GetStopInfo(); } // If the completion of the thread plan stepped out of a function, the return - // value of the function - // might have been captured by the thread plan (currently only - // ThreadPlanStepOut does this.) - // If so, the ReturnValueObject can be retrieved from here. + // value of the function might have been captured by the thread plan + // (currently only ThreadPlanStepOut does this.) If so, the ReturnValueObject + // can be retrieved from here. virtual lldb::ValueObjectSP GetReturnValueObject() { return lldb::ValueObjectSP(); } // If the thread plan managing the evaluation of a user expression lives - // longer than the command - // that instigated the expression (generally because the expression evaluation - // hit a breakpoint, and - // the user regained control at that point) a subsequent process control - // command step/continue/etc. might - // complete the expression evaluations. If so, the result of the expression - // evaluation will show up here. + // longer than the command that instigated the expression (generally because + // the expression evaluation hit a breakpoint, and the user regained control + // at that point) a subsequent process control command step/continue/etc. + // might complete the expression evaluations. If so, the result of the + // expression evaluation will show up here. virtual lldb::ExpressionVariableSP GetExpressionVariable() { return lldb::ExpressionVariableSP(); } - // If a thread plan stores the state before it was run, then you might - // want to restore the state when it is done. This will do that job. - // This is mostly useful for artificial plans like CallFunction plans. + // If a thread plan stores the state before it was run, then you might want + // to restore the state when it is done. This will do that job. This is + // mostly useful for artificial plans like CallFunction plans. virtual bool RestoreThreadState() { // Nothing to do in general. @@ -585,8 +578,7 @@ ThreadPlan *GetPreviousPlan() { return m_thread.GetPreviousPlan(this); } // This forwards the private Thread::GetPrivateStopInfo which is generally - // what - // ThreadPlan's need to know. + // what ThreadPlan's need to know. lldb::StopInfoSP GetPrivateStopInfo() { return m_thread.GetPrivateStopInfo(); @@ -638,10 +630,10 @@ //---------------------------------------------------------------------- // ThreadPlanNull: -// Threads are assumed to always have at least one plan on the plan stack. -// This is put on the plan stack when a thread is destroyed so that if you -// accidentally access a thread after it is destroyed you won't crash. -// But asking questions of the ThreadPlanNull is definitely an error. +// Threads are assumed to always have at least one plan on the plan stack. This +// is put on the plan stack when a thread is destroyed so that if you +// accidentally access a thread after it is destroyed you won't crash. But +// asking questions of the ThreadPlanNull is definitely an error. //---------------------------------------------------------------------- class ThreadPlanNull : public ThreadPlan { Index: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h @@ -24,9 +24,8 @@ class ThreadPlanCallFunction : public ThreadPlan { // Create a thread plan to call a function at the address passed in the - // "function" - // argument. If you plan to call GetReturnValueObject, then pass in the - // return type, otherwise just pass in an invalid CompilerType. + // "function" argument. If you plan to call GetReturnValueObject, then pass + // in the return type, otherwise just pass in an invalid CompilerType. public: ThreadPlanCallFunction(Thread &thread, const Address &function, const CompilerType &return_type, @@ -69,27 +68,23 @@ return m_return_valobj_sp; } - // Return the stack pointer that the function received - // on entry. Any stack address below this should be - // considered invalid after the function has been - // cleaned up. + // Return the stack pointer that the function received on entry. Any stack + // address below this should be considered invalid after the function has + // been cleaned up. lldb::addr_t GetFunctionStackPointer() { return m_function_sp; } - // Classes that derive from FunctionCaller, and implement - // their own WillPop methods should call this so that the - // thread state gets restored if the plan gets discarded. + // Classes that derive from FunctionCaller, and implement their own WillPop + // methods should call this so that the thread state gets restored if the + // plan gets discarded. void WillPop() override; // If the thread plan stops mid-course, this will be the stop reason that - // interrupted us. - // Once DoTakedown is called, this will be the real stop reason at the end of - // the function call. - // If it hasn't been set for one or the other of these reasons, we'll return - // the PrivateStopReason. - // This is needed because we want the CallFunction thread plans not to show up - // as the stop reason. - // But if something bad goes wrong, it is nice to be able to tell the user - // what really happened. + // interrupted us. Once DoTakedown is called, this will be the real stop + // reason at the end of the function call. If it hasn't been set for one or + // the other of these reasons, we'll return the PrivateStopReason. This is + // needed because we want the CallFunction thread plans not to show up as the + // stop reason. But if something bad goes wrong, it is nice to be able to + // tell the user what really happened. lldb::StopInfoSP GetRealStopInfo() override { if (m_real_stop_info_sp) @@ -140,9 +135,9 @@ Thread::ThreadStateCheckpoint m_stored_thread_state; lldb::StopInfoSP m_real_stop_info_sp; // In general we want to hide call function - // thread plans, but for reporting purposes, - // it's nice to know the real stop reason. - // This gets set in DoTakedown. + // thread plans, but for reporting purposes, it's + // nice to know the real stop reason. This gets set + // in DoTakedown. StreamString m_constructor_errors; lldb::ValueObjectSP m_return_valobj_sp; // If this contains a valid pointer, // use the ABI to extract values when Index: lldb/trunk/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h +++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunctionUsingABI.h @@ -27,11 +27,9 @@ class ThreadPlanCallFunctionUsingABI : public ThreadPlanCallFunction { // Create a thread plan to call a function at the address passed in the - // "function" - // argument, this function is executed using register manipulation instead of - // JIT. - // Class derives from ThreadPlanCallFunction and differs by calling a - // alternative + // "function" argument, this function is executed using register manipulation + // instead of JIT. Class derives from ThreadPlanCallFunction and differs by + // calling a alternative // ABI interface ABI::PrepareTrivialCall() which provides more detailed // information. public: Index: lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h +++ lldb/trunk/include/lldb/Target/ThreadPlanShouldStopHere.h @@ -19,20 +19,16 @@ namespace lldb_private { // This is an interface that ThreadPlans can adopt to allow flexible -// modifications of the behavior -// when a thread plan comes to a place where it would ordinarily stop. If such -// modification makes -// sense for your plan, inherit from this class, and when you would be about to -// stop (in your ShouldStop -// method), call InvokeShouldStopHereCallback, passing in the frame comparison -// between where the step operation -// started and where you arrived. If it returns true, then QueueStepOutFromHere -// will queue the plan -// to execute instead of stopping. +// modifications of the behavior when a thread plan comes to a place where it +// would ordinarily stop. If such modification makes sense for your plan, +// inherit from this class, and when you would be about to stop (in your +// ShouldStop method), call InvokeShouldStopHereCallback, passing in the frame +// comparison between where the step operation started and where you arrived. +// If it returns true, then QueueStepOutFromHere will queue the plan to execute +// instead of stopping. // // The classic example of the use of this is ThreadPlanStepInRange not stopping -// in frames that have -// no debug information. +// in frames that have no debug information. // // This class also defines a set of flags to control general aspects of this // "ShouldStop" behavior. @@ -82,11 +78,9 @@ virtual ~ThreadPlanShouldStopHere(); // Set the ShouldStopHere callbacks. Pass in null to clear them and have no - // special behavior (though you - // can also call ClearShouldStopHereCallbacks for that purpose. If you pass - // in a valid pointer, it will - // adopt the non-null fields, and any null fields will be set to the default - // values. + // special behavior (though you can also call ClearShouldStopHereCallbacks + // for that purpose. If you pass in a valid pointer, it will adopt the non- + // null fields, and any null fields will be set to the default values. void SetShouldStopHereCallbacks(const ThreadPlanShouldStopHereCallbacks *callbacks, Index: lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h =================================================================== --- lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h +++ lldb/trunk/include/lldb/Target/ThreadPlanStepRange.h @@ -58,10 +58,9 @@ size_t &insn_offset); // Pushes a plan to proceed through the next section of instructions in the - // range - usually just a RunToAddress - // plan to run to the next branch. Returns true if it pushed such a plan. If - // there was no available 'quick run' - // plan, then just single step. + // range - usually just a RunToAddress plan to run to the next branch. + // Returns true if it pushed such a plan. If there was no available 'quick + // run' plan, then just single step. bool SetNextBranchBreakpoint(); void ClearNextBranchBreakpoint(); Index: lldb/trunk/include/lldb/Target/UnixSignals.h =================================================================== --- lldb/trunk/include/lldb/Target/UnixSignals.h +++ lldb/trunk/include/lldb/Target/UnixSignals.h @@ -63,8 +63,7 @@ // These provide an iterator through the signals available on this system. // Call GetFirstSignalNumber to get the first entry, then iterate on - // GetNextSignalNumber - // till you get back LLDB_INVALID_SIGNAL_NUMBER. + // GetNextSignalNumber till you get back LLDB_INVALID_SIGNAL_NUMBER. int32_t GetFirstSignalNumber() const; int32_t GetNextSignalNumber(int32_t current_signal) const; @@ -76,13 +75,10 @@ ConstString GetShortName(ConstString name) const; // We assume that the elements of this object are constant once it is - // constructed, - // since a process should never need to add or remove symbols as it runs. So - // don't - // call these functions anywhere but the constructor of your subclass of - // UnixSignals or in - // your Process Plugin's GetUnixSignals method before you return the - // UnixSignal object. + // constructed, since a process should never need to add or remove symbols as + // it runs. So don't call these functions anywhere but the constructor of + // your subclass of UnixSignals or in your Process Plugin's GetUnixSignals + // method before you return the UnixSignal object. void AddSignal(int signo, const char *name, bool default_suppress, bool default_stop, bool default_notify, @@ -90,15 +86,14 @@ void RemoveSignal(int signo); - // Returns a current version of the data stored in this class. - // Version gets incremented each time Set... method is called. + // Returns a current version of the data stored in this class. Version gets + // incremented each time Set... method is called. uint64_t GetVersion() const; - // Returns a vector of signals that meet criteria provided in arguments. - // Each should_[suppress|stop|notify] flag can be - // None - no filtering by this flag - // true - only signals that have it set to true are returned - // false - only signals that have it set to true are returned + // Returns a vector of signals that meet criteria provided in arguments. Each + // should_[suppress|stop|notify] flag can be None - no filtering by this + // flag true - only signals that have it set to true are returned false - + // only signals that have it set to true are returned std::vector GetFilteredSignals(llvm::Optional should_suppress, llvm::Optional should_stop, llvm::Optional should_notify); @@ -126,10 +121,10 @@ collection m_signals; - // This version gets incremented every time something is changing in - // this class, including when we call AddSignal from the constructor. - // So after the object is constructed m_version is going to be > 0 - // if it has at least one signal registered in it. + // This version gets incremented every time something is changing in this + // class, including when we call AddSignal from the constructor. So after the + // object is constructed m_version is going to be > 0 if it has at least one + // signal registered in it. uint64_t m_version = 0; // GDBRemote signals need to be copyable. Index: lldb/trunk/include/lldb/Utility/ArchSpec.h =================================================================== --- lldb/trunk/include/lldb/Utility/ArchSpec.h +++ lldb/trunk/include/lldb/Utility/ArchSpec.h @@ -592,15 +592,14 @@ Core m_core = kCore_invalid; lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid; - // Additional arch flags which we cannot get from triple and core - // For MIPS these are application specific extensions like - // micromips, mips16 etc. + // Additional arch flags which we cannot get from triple and core For MIPS + // these are application specific extensions like micromips, mips16 etc. uint32_t m_flags = 0; ConstString m_distribution_id; - // Called when m_def or m_entry are changed. Fills in all remaining - // members with default values. + // Called when m_def or m_entry are changed. Fills in all remaining members + // with default values. void CoreUpdated(bool update_triple); }; Index: lldb/trunk/include/lldb/Utility/Args.h =================================================================== --- lldb/trunk/include/lldb/Utility/Args.h +++ lldb/trunk/include/lldb/Utility/Args.h @@ -343,11 +343,11 @@ static void EncodeEscapeSequences(const char *src, std::string &dst); // ExpandEscapeSequences will change a string of possibly non-printable - // characters and expand them into text. So '\n' will turn into two characters - // like "\n" which is suitable for human reading. When a character is not - // printable and isn't one of the common in escape sequences listed in the - // help for EncodeEscapeSequences, then it will be encoded as octal. Printable - // characters are left alone. + // characters and expand them into text. So '\n' will turn into two + // characters like "\n" which is suitable for human reading. When a character + // is not printable and isn't one of the common in escape sequences listed in + // the help for EncodeEscapeSequences, then it will be encoded as octal. + // Printable characters are left alone. static void ExpandEscapedCharacters(const char *src, std::string &dst); static std::string EscapeLLDBCommandArgument(const std::string &arg, Index: lldb/trunk/include/lldb/Utility/ConstString.h =================================================================== --- lldb/trunk/include/lldb/Utility/ConstString.h +++ lldb/trunk/include/lldb/Utility/ConstString.h @@ -174,8 +174,8 @@ /// @li \b false if this object is not equal to \a rhs. //------------------------------------------------------------------ bool operator==(const ConstString &rhs) const { - // We can do a pointer compare to compare these strings since they - // must come from the same pool in order to be equal. + // We can do a pointer compare to compare these strings since they must + // come from the same pool in order to be equal. return m_string == rhs.m_string; } Index: lldb/trunk/include/lldb/Utility/DataBufferHeap.h =================================================================== --- lldb/trunk/include/lldb/Utility/DataBufferHeap.h +++ lldb/trunk/include/lldb/Utility/DataBufferHeap.h @@ -123,8 +123,8 @@ private: //------------------------------------------------------------------ - // This object uses a std::vector to store its data. This - // takes care of free the data when the object is deleted. + // This object uses a std::vector to store its data. This takes care + // of free the data when the object is deleted. //------------------------------------------------------------------ typedef std::vector buffer_t; ///< Buffer type buffer_t m_data; ///< The heap based buffer where data is stored Index: lldb/trunk/include/lldb/Utility/History.h =================================================================== --- lldb/trunk/include/lldb/Utility/History.h +++ lldb/trunk/include/lldb/Utility/History.h @@ -39,9 +39,9 @@ virtual ~HistorySource() {} - // Create a new history event. Subclasses should use any data or members - // in the subclass of this class to produce a history event and push it - // onto the end of the history stack. + // Create a new history event. Subclasses should use any data or members in + // the subclass of this class to produce a history event and push it onto the + // end of the history stack. virtual HistoryEvent CreateHistoryEvent() = 0; @@ -85,9 +85,9 @@ ~HistorySourceUInt() override {} - // Create a new history event. Subclasses should use any data or members - // in the subclass of this class to produce a history event and push it - // onto the end of the history stack. + // Create a new history event. Subclasses should use any data or members in + // the subclass of this class to produce a history event and push it onto the + // end of the history stack. HistoryEvent CreateHistoryEvent() override { ++m_curr_id; Index: lldb/trunk/include/lldb/Utility/JSON.h =================================================================== --- lldb/trunk/include/lldb/Utility/JSON.h +++ lldb/trunk/include/lldb/Utility/JSON.h @@ -79,9 +79,8 @@ // SFINAE to avoid having ambiguous overloads because of the implicit type // promotion. If we // would have constructors only with int64_t, uint64_t and double types then - // constructing a - // JSONNumber from an int32_t (or any other similar type) would fail to - // compile. + // constructing a JSONNumber from an int32_t (or any other similar type) + // would fail to compile. template ::value && Index: lldb/trunk/include/lldb/Utility/Log.h =================================================================== --- lldb/trunk/include/lldb/Utility/Log.h +++ lldb/trunk/include/lldb/Utility/Log.h @@ -74,10 +74,10 @@ : log_ptr(nullptr), categories(categories), default_flags(default_flags) {} - // This function is safe to call at any time - // If the channel is disabled after (or concurrently with) this function - // returning a non-null Log pointer, it is still safe to attempt to write to - // the Log object -- the output will be discarded. + // This function is safe to call at any time If the channel is disabled + // after (or concurrently with) this function returning a non-null Log + // pointer, it is still safe to attempt to write to the Log object -- the + // output will be discarded. Log *GetLogIfAll(uint32_t mask) { Log *log = log_ptr.load(std::memory_order_relaxed); if (log && log->GetMask().AllSet(mask)) @@ -85,10 +85,10 @@ return nullptr; } - // This function is safe to call at any time - // If the channel is disabled after (or concurrently with) this function - // returning a non-null Log pointer, it is still safe to attempt to write to - // the Log object -- the output will be discarded. + // This function is safe to call at any time If the channel is disabled + // after (or concurrently with) this function returning a non-null Log + // pointer, it is still safe to attempt to write to the Log object -- the + // output will be discarded. Log *GetLogIfAny(uint32_t mask) { Log *log = log_ptr.load(std::memory_order_relaxed); if (log && log->GetMask().AnySet(mask)) @@ -171,8 +171,8 @@ private: Channel &m_channel; - // The mutex makes sure enable/disable operations are thread-safe. The options - // and mask variables are atomic to enable their reading in + // The mutex makes sure enable/disable operations are thread-safe. The + // options and mask variables are atomic to enable their reading in // Channel::GetLogIfAny without taking the mutex to speed up the fast path. // Their modification however, is still protected by this mutex. llvm::sys::RWMutex m_mutex; Index: lldb/trunk/include/lldb/Utility/SafeMachO.h =================================================================== --- lldb/trunk/include/lldb/Utility/SafeMachO.h +++ lldb/trunk/include/lldb/Utility/SafeMachO.h @@ -9,18 +9,15 @@ #ifndef liblldb_SafeMachO_h_ #define liblldb_SafeMachO_h_ -// This header file is required to work around collisions between the defines in -// mach/machine.h, and enum members -// of the same name in llvm's MachO.h. If you want to use llvm/Support/MachO.h, -// use this file instead. -// The caveats are: -// 1) You can only use the MachO.h enums, you can't use the defines. That won't -// make a difference since the values +// This header file is required to work around collisions between the defines +// in mach/machine.h, and enum members of the same name in llvm's MachO.h. If +// you want to use llvm/Support/MachO.h, use this file instead. The caveats +// are: 1) You can only use the MachO.h enums, you can't use the defines. That +// won't make a difference since the values // are the same. // 2) If you need any header file that relies on mach/machine.h, you must -// include that first. -// 3) This isn't a total solution, it doesn't undef every define that MachO.h -// has borrowed from various system headers, +// include that first. 3) This isn't a total solution, it doesn't undef every +// define that MachO.h has borrowed from various system headers, // only the ones that come from mach/machine.h because that is the one we // ended up pulling in from various places. // Index: lldb/trunk/include/lldb/Utility/SelectHelper.h =================================================================== --- lldb/trunk/include/lldb/Utility/SelectHelper.h +++ lldb/trunk/include/lldb/Utility/SelectHelper.h @@ -23,32 +23,31 @@ // Defaults to infinite wait for select unless you call SetTimeout() SelectHelper(); - // Call SetTimeout() before calling SelectHelper::Select() to set the - // timeout based on the current time + the timeout. This allows multiple - // calls to SelectHelper::Select() without having to worry about the - // absolute timeout as this class manages to set the relative timeout - // correctly. + // Call SetTimeout() before calling SelectHelper::Select() to set the timeout + // based on the current time + the timeout. This allows multiple calls to + // SelectHelper::Select() without having to worry about the absolute timeout + // as this class manages to set the relative timeout correctly. void SetTimeout(const std::chrono::microseconds &timeout); - // Call the FDSet*() functions before calling SelectHelper::Select() to - // set the file descriptors that we will watch for when calling - // select. This will cause FD_SET() to be called prior to calling select - // using the "fd" provided. + // Call the FDSet*() functions before calling SelectHelper::Select() to set + // the file descriptors that we will watch for when calling select. This will + // cause FD_SET() to be called prior to calling select using the "fd" + // provided. void FDSetRead(lldb::socket_t fd); void FDSetWrite(lldb::socket_t fd); void FDSetError(lldb::socket_t fd); - // Call the FDIsSet*() functions after calling SelectHelper::Select() - // to check which file descriptors are ready for read/write/error. This - // will contain the result of FD_ISSET after calling select for a given - // file descriptor. + // Call the FDIsSet*() functions after calling SelectHelper::Select() to + // check which file descriptors are ready for read/write/error. This will + // contain the result of FD_ISSET after calling select for a given file + // descriptor. bool FDIsSetRead(lldb::socket_t fd) const; bool FDIsSetWrite(lldb::socket_t fd) const; bool FDIsSetError(lldb::socket_t fd) const; - // Call the system's select() to wait for descriptors using - // timeout provided in a call the SelectHelper::SetTimeout(), - // or infinite wait if no timeout was set. + // Call the system's select() to wait for descriptors using timeout provided + // in a call the SelectHelper::SetTimeout(), or infinite wait if no timeout + // was set. lldb_private::Status Select(); protected: Index: lldb/trunk/include/lldb/Utility/SharedCluster.h =================================================================== --- lldb/trunk/include/lldb/Utility/SharedCluster.h +++ lldb/trunk/include/lldb/Utility/SharedCluster.h @@ -50,9 +50,9 @@ delete object; } - // Decrement refcount should have been called on this ClusterManager, - // and it should have locked the mutex, now we will unlock it before - // we destroy it... + // Decrement refcount should have been called on this ClusterManager, and + // it should have locked the mutex, now we will unlock it before we destroy + // it... m_mutex.unlock(); } Index: lldb/trunk/include/lldb/Utility/SharingPtr.h =================================================================== --- lldb/trunk/include/lldb/Utility/SharingPtr.h +++ lldb/trunk/include/lldb/Utility/SharingPtr.h @@ -14,9 +14,9 @@ // C++ Includes #include -// Microsoft Visual C++ currently does not enable std::atomic to work -// in CLR mode - as such we need to "hack around it" for MSVC++ builds only -// using Windows specific intrinsics instead of the C++11 atomic support +// Microsoft Visual C++ currently does not enable std::atomic to work in CLR +// mode - as such we need to "hack around it" for MSVC++ builds only using +// Windows specific intrinsics instead of the C++11 atomic support #ifdef _MSC_VER #include #else Index: lldb/trunk/include/lldb/Utility/Stream.h =================================================================== --- lldb/trunk/include/lldb/Utility/Stream.h +++ lldb/trunk/include/lldb/Utility/Stream.h @@ -163,8 +163,8 @@ size_t PutPointer(void *ptr); - // Append \a src_len bytes from \a src to the stream as hex characters - // (two ascii characters per byte of input data) + // Append \a src_len bytes from \a src to the stream as hex characters (two + // ascii characters per byte of input data) size_t PutBytesAsRawHex8(const void *src, size_t src_len, lldb::ByteOrder src_byte_order = lldb::eByteOrderInvalid, Index: lldb/trunk/include/lldb/Utility/StreamTee.h =================================================================== --- lldb/trunk/include/lldb/Utility/StreamTee.h +++ lldb/trunk/include/lldb/Utility/StreamTee.h @@ -61,10 +61,9 @@ std::lock_guard guard(m_streams_mutex); collection::iterator pos, end; for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos) { - // Allow for our collection to contain NULL streams. This allows - // the StreamTee to be used with hard coded indexes for clients - // that might want N total streams with only a few that are set - // to valid values. + // Allow for our collection to contain NULL streams. This allows the + // StreamTee to be used with hard coded indexes for clients that might + // want N total streams with only a few that are set to valid values. Stream *strm = pos->get(); if (strm) strm->Flush(); @@ -79,10 +78,9 @@ size_t min_bytes_written = SIZE_MAX; collection::iterator pos, end; for (pos = m_streams.begin(), end = m_streams.end(); pos != end; ++pos) { - // Allow for our collection to contain NULL streams. This allows - // the StreamTee to be used with hard coded indexes for clients - // that might want N total streams with only a few that are set - // to valid values. + // Allow for our collection to contain NULL streams. This allows the + // StreamTee to be used with hard coded indexes for clients that might + // want N total streams with only a few that are set to valid values. Stream *strm = pos->get(); if (strm) { const size_t bytes_written = strm->Write(s, length); @@ -121,10 +119,9 @@ void SetStreamAtIndex(uint32_t idx, const lldb::StreamSP &stream_sp) { std::lock_guard guard(m_streams_mutex); - // Resize our stream vector as necessary to fit as many streams - // as needed. This also allows this class to be used with hard - // coded indexes that can be used contain many streams, not all - // of which are valid. + // Resize our stream vector as necessary to fit as many streams as needed. + // This also allows this class to be used with hard coded indexes that can + // be used contain many streams, not all of which are valid. if (idx >= m_streams.size()) m_streams.resize(idx + 1); m_streams[idx] = stream_sp; Index: lldb/trunk/include/lldb/Utility/StringExtractor.h =================================================================== --- lldb/trunk/include/lldb/Utility/StringExtractor.h +++ lldb/trunk/include/lldb/Utility/StringExtractor.h @@ -41,8 +41,8 @@ m_index = 0; } - // Returns true if the file position is still valid for the data - // contained in this string extractor object. + // Returns true if the file position is still valid for the data contained in + // this string extractor object. bool IsGood() const { return m_index != UINT64_MAX; } uint64_t GetFilePos() const { return m_index; } @@ -129,9 +129,9 @@ //------------------------------------------------------------------ std::string m_packet; // The string in which to extract data. uint64_t m_index; // When extracting data from a packet, this index - // will march along as things get extracted. If set - // to UINT64_MAX the end of the packet data was - // reached when decoding information + // will march along as things get extracted. If set to + // UINT64_MAX the end of the packet data was reached + // when decoding information }; #endif // utility_StringExtractor_h_ Index: lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h =================================================================== --- lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h +++ lldb/trunk/include/lldb/Utility/StringExtractorGDBRemote.h @@ -188,8 +188,8 @@ bool IsErrorResponse() const; - // Returns zero if the packet isn't a EXX packet where XX are two hex - // digits. Otherwise the error encoded in XX is returned. + // Returns zero if the packet isn't a EXX packet where XX are two hex digits. + // Otherwise the error encoded in XX is returned. uint8_t GetError(); lldb_private::Status GetStatus(); Index: lldb/trunk/include/lldb/Utility/StringList.h =================================================================== --- lldb/trunk/include/lldb/Utility/StringList.h +++ lldb/trunk/include/lldb/Utility/StringList.h @@ -100,20 +100,17 @@ // Copy assignment for a vector of strings StringList &operator=(const std::vector &rhs); - // This string list contains a list of valid auto completion - // strings, and the "s" is passed in. "matches" is filled in - // with zero or more string values that start with "s", and - // the first string to exactly match one of the string - // values in this collection, will have "exact_matches_idx" - // filled in to match the index, or "exact_matches_idx" will - // have SIZE_MAX + // This string list contains a list of valid auto completion strings, and the + // "s" is passed in. "matches" is filled in with zero or more string values + // that start with "s", and the first string to exactly match one of the + // string values in this collection, will have "exact_matches_idx" filled in + // to match the index, or "exact_matches_idx" will have SIZE_MAX size_t AutoComplete(llvm::StringRef s, StringList &matches, size_t &exact_matches_idx) const; // Dump the StringList to the given lldb_private::Log, `log`, one item per - // line. - // If given, `name` will be used to identify the start and end of the list in - // the output. + // line. If given, `name` will be used to identify the start and end of the + // list in the output. virtual void LogDump(Log *log, const char *name = nullptr); // Static helper to convert an iterable of strings to a StringList, and then Index: lldb/trunk/include/lldb/Utility/Timeout.h =================================================================== --- lldb/trunk/include/lldb/Utility/Timeout.h +++ lldb/trunk/include/lldb/Utility/Timeout.h @@ -22,9 +22,9 @@ // from Timeout to Timeout. // // The intended meaning of the values is: -// - llvm::None - no timeout, the call should wait forever -// - 0 - poll, only complete the call if it will not block -// - >0 - wait for a given number of units for the result +// - llvm::None - no timeout, the call should wait forever - 0 - poll, only +// complete the call if it will not block - >0 - wait for a given number of +// units for the result template class Timeout : public llvm::Optional> { private: Index: lldb/trunk/include/lldb/lldb-enumerations.h =================================================================== --- lldb/trunk/include/lldb/lldb-enumerations.h +++ lldb/trunk/include/lldb/lldb-enumerations.h @@ -21,8 +21,8 @@ // warning, as it's part of -Wmicrosoft which also catches a whole slew of // other useful issues. // -// To make matters worse, early versions of SWIG don't recognize the syntax -// of specifying the underlying type of an enum (and Python doesn't care anyway) +// To make matters worse, early versions of SWIG don't recognize the syntax of +// specifying the underlying type of an enum (and Python doesn't care anyway) // so we need a way to specify the underlying type when the enum is being used // from C++ code, but just use a regular enum when swig is pre-processing. #define FLAGS_ENUM(Name) enum Name : unsigned @@ -193,9 +193,8 @@ //---------------------------------------------------------------------- // Register numbering types -// See RegisterContext::ConvertRegisterKindToRegisterNumber to convert -// any of these to the lldb internal register numbering scheme -// (eRegisterKindLLDB). +// See RegisterContext::ConvertRegisterKindToRegisterNumber to convert any of +// these to the lldb internal register numbering scheme (eRegisterKindLLDB). //---------------------------------------------------------------------- enum RegisterKind { eRegisterKindEHFrame = 0, // the register numbers seen in eh_frame @@ -445,8 +444,8 @@ // Vendor Extensions // Note: Language::GetNameForLanguageType // assumes these can be used as indexes into array language_names, and - // Language::SetLanguageFromCString and Language::AsCString - // assume these can be used as indexes into array g_languages. + // Language::SetLanguageFromCString and Language::AsCString assume these can + // be used as indexes into array g_languages. eLanguageTypeMipsAssembler = 0x0024, ///< Mips_Assembler. eLanguageTypeExtRenderScript = 0x0025, ///< RenderScript. eNumLanguageTypes @@ -671,10 +670,10 @@ (1u << 1), // Automatically figure out which FunctionNameType // bits to set based on the function name. eFunctionNameTypeFull = (1u << 2), // The function name. - // For C this is the same as just the name of the function - // For C++ this is the mangled or demangled version of the mangled name. - // For ObjC this is the full function signature with the + or - // - and the square brackets and the class and selector + // For C this is the same as just the name of the function For C++ this is + // the mangled or demangled version of the mangled name. For ObjC this is + // the full function signature with the + or - and the square brackets and + // the class and selector eFunctionNameTypeBase = (1u << 3), // The function name only, no namespaces // or arguments and no class // methods or selectors will be searched. @@ -773,8 +772,8 @@ }; //---------------------------------------------------------------------- -// Options that can be set for a formatter to alter its behavior -// Not all of these are applicable to all formatter types +// Options that can be set for a formatter to alter its behavior Not all of +// these are applicable to all formatter types //---------------------------------------------------------------------- FLAGS_ENUM(TypeOptions){eTypeOptionNone = (0u), eTypeOptionCascade = (1u << 0), @@ -788,20 +787,17 @@ eTypeOptionHideEmptyAggregates = (1u << 8)}; //---------------------------------------------------------------------- -// This is the return value for frame comparisons. If you are comparing frame A -// to frame B -// the following cases arise: -// 1) When frame A pushes frame B (or a frame that ends up pushing B) A is Older -// than B. -// 2) When frame A pushed frame B (or if frame A is on the stack but B is not) A -// is Younger than B -// 3) When frame A and frame B have the same StackID, they are Equal. -// 4) When frame A and frame B have the same immediate parent frame, but are not -// equal, the comparison yields +// This is the return value for frame comparisons. If you are comparing frame +// A to frame B the following cases arise: 1) When frame A pushes frame B (or a +// frame that ends up pushing B) A is Older than B. 2) When frame A pushed +// frame B (or if frame A is on the stack but B is not) A is Younger than B 3) +// When frame A and frame B have the same StackID, they are Equal. 4) When +// frame A and frame B have the same immediate parent frame, but are not equal, +// the comparison yields // SameParent. // 5) If the two frames are on different threads or processes the comparison is -// Invalid -// 6) If for some reason we can't figure out what went on, we return Unknown. +// Invalid 6) If for some reason we can't figure out what went on, we return +// Unknown. //---------------------------------------------------------------------- enum FrameComparison { eFrameCompareInvalid, @@ -816,11 +812,11 @@ // Address Class // // A way of classifying an address used for disassembling and setting -// breakpoints. Many object files can track exactly what parts of their -// object files are code, data and other information. This is of course -// above and beyond just looking at the section types. For example, code -// might contain PC relative data and the object file might be able to -// tell us that an address in code is data. +// breakpoints. Many object files can track exactly what parts of their object +// files are code, data and other information. This is of course above and +// beyond just looking at the section types. For example, code might contain PC +// relative data and the object file might be able to tell us that an address +// in code is data. //---------------------------------------------------------------------- enum AddressClass { eAddressClassInvalid, @@ -835,9 +831,8 @@ //---------------------------------------------------------------------- // File Permissions // -// Designed to mimic the unix file permission bits so they can be -// used with functions that set 'mode_t' to certain values for -// permissions. +// Designed to mimic the unix file permission bits so they can be used with +// functions that set 'mode_t' to certain values for permissions. //---------------------------------------------------------------------- FLAGS_ENUM(FilePermissions){ eFilePermissionsUserRead = (1u << 8), eFilePermissionsUserWrite = (1u << 7), @@ -897,8 +892,8 @@ //---------------------------------------------------------------------- // Queue work item types // -// The different types of work that can be enqueued on a libdispatch -// aka Grand Central Dispatch (GCD) queue. +// The different types of work that can be enqueued on a libdispatch aka Grand +// Central Dispatch (GCD) queue. //---------------------------------------------------------------------- enum QueueItemKind { eQueueItemKindUnknown = 0, @@ -932,8 +927,8 @@ //---------------------------------------------------------------------- // Watchpoint Kind -// Indicates what types of events cause the watchpoint to fire. -// Used by Native*Protocol-related classes. +// Indicates what types of events cause the watchpoint to fire. Used by Native +// *Protocol-related classes. //---------------------------------------------------------------------- FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0), eWatchpointKindRead = (1u << 1)}; @@ -948,9 +943,9 @@ }; //---------------------------------------------------------------------- -// Used with SBHost::GetPath (lldb::PathType) to find files that are -// related to LLDB on the current host machine. Most files are relative -// to LLDB or are in known locations. +// Used with SBHost::GetPath (lldb::PathType) to find files that are related to +// LLDB on the current host machine. Most files are relative to LLDB or are in +// known locations. //---------------------------------------------------------------------- enum PathType { ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB @@ -1009,58 +1004,54 @@ //---------------------------------------------------------------------- // eCommandRequiresTarget // - // Ensures a valid target is contained in m_exe_ctx prior to executing - // the command. If a target doesn't exist or is invalid, the command - // will fail and CommandObject::GetInvalidTargetDescription() will be - // returned as the error. CommandObject subclasses can override the - // virtual function for GetInvalidTargetDescription() to provide custom - // strings when needed. + // Ensures a valid target is contained in m_exe_ctx prior to executing the + // command. If a target doesn't exist or is invalid, the command will fail + // and CommandObject::GetInvalidTargetDescription() will be returned as the + // error. CommandObject subclasses can override the virtual function for + // GetInvalidTargetDescription() to provide custom strings when needed. //---------------------------------------------------------------------- eCommandRequiresTarget = (1u << 0), //---------------------------------------------------------------------- // eCommandRequiresProcess // - // Ensures a valid process is contained in m_exe_ctx prior to executing - // the command. If a process doesn't exist or is invalid, the command - // will fail and CommandObject::GetInvalidProcessDescription() will be - // returned as the error. CommandObject subclasses can override the - // virtual function for GetInvalidProcessDescription() to provide custom - // strings when needed. + // Ensures a valid process is contained in m_exe_ctx prior to executing the + // command. If a process doesn't exist or is invalid, the command will fail + // and CommandObject::GetInvalidProcessDescription() will be returned as + // the error. CommandObject subclasses can override the virtual function + // for GetInvalidProcessDescription() to provide custom strings when + // needed. //---------------------------------------------------------------------- eCommandRequiresProcess = (1u << 1), //---------------------------------------------------------------------- // eCommandRequiresThread // - // Ensures a valid thread is contained in m_exe_ctx prior to executing - // the command. If a thread doesn't exist or is invalid, the command - // will fail and CommandObject::GetInvalidThreadDescription() will be - // returned as the error. CommandObject subclasses can override the - // virtual function for GetInvalidThreadDescription() to provide custom - // strings when needed. + // Ensures a valid thread is contained in m_exe_ctx prior to executing the + // command. If a thread doesn't exist or is invalid, the command will fail + // and CommandObject::GetInvalidThreadDescription() will be returned as the + // error. CommandObject subclasses can override the virtual function for + // GetInvalidThreadDescription() to provide custom strings when needed. //---------------------------------------------------------------------- eCommandRequiresThread = (1u << 2), //---------------------------------------------------------------------- // eCommandRequiresFrame // - // Ensures a valid frame is contained in m_exe_ctx prior to executing - // the command. If a frame doesn't exist or is invalid, the command - // will fail and CommandObject::GetInvalidFrameDescription() will be - // returned as the error. CommandObject subclasses can override the - // virtual function for GetInvalidFrameDescription() to provide custom - // strings when needed. + // Ensures a valid frame is contained in m_exe_ctx prior to executing the + // command. If a frame doesn't exist or is invalid, the command will fail + // and CommandObject::GetInvalidFrameDescription() will be returned as the + // error. CommandObject subclasses can override the virtual function for + // GetInvalidFrameDescription() to provide custom strings when needed. //---------------------------------------------------------------------- eCommandRequiresFrame = (1u << 3), //---------------------------------------------------------------------- // eCommandRequiresRegContext // - // Ensures a valid register context (from the selected frame if there - // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx) - // is available from m_exe_ctx prior to executing the command. If a - // target doesn't exist or is invalid, the command will fail and - // CommandObject::GetInvalidRegContextDescription() will be returned as - // the error. CommandObject subclasses can override the virtual function - // for GetInvalidRegContextDescription() to provide custom strings when - // needed. + // Ensures a valid register context (from the selected frame if there is a + // frame in m_exe_ctx, or from the selected thread from m_exe_ctx) is + // available from m_exe_ctx prior to executing the command. If a target + // doesn't exist or is invalid, the command will fail and + // CommandObject::GetInvalidRegContextDescription() will be returned as the + // error. CommandObject subclasses can override the virtual function for + // GetInvalidRegContextDescription() to provide custom strings when needed. //---------------------------------------------------------------------- eCommandRequiresRegContext = (1u << 4), //---------------------------------------------------------------------- @@ -1074,15 +1065,15 @@ //---------------------------------------------------------------------- // eCommandProcessMustBeLaunched // - // Verifies that there is a launched process in m_exe_ctx, if there - // isn't, the command will fail with an appropriate error message. + // Verifies that there is a launched process in m_exe_ctx, if there isn't, + // the command will fail with an appropriate error message. //---------------------------------------------------------------------- eCommandProcessMustBeLaunched = (1u << 6), //---------------------------------------------------------------------- // eCommandProcessMustBePaused // - // Verifies that there is a paused process in m_exe_ctx, if there - // isn't, the command will fail with an appropriate error message. + // Verifies that there is a paused process in m_exe_ctx, if there isn't, + // the command will fail with an appropriate error message. //---------------------------------------------------------------------- eCommandProcessMustBePaused = (1u << 7)}; Index: lldb/trunk/include/lldb/lldb-private-enumerations.h =================================================================== --- lldb/trunk/include/lldb/lldb-private-enumerations.h +++ lldb/trunk/include/lldb/lldb-private-enumerations.h @@ -105,9 +105,9 @@ } SortOrder; //---------------------------------------------------------------------- -// LazyBool is for boolean values that need to be calculated lazily. -// Values start off set to eLazyBoolCalculate, and then they can be -// calculated once and set to eLazyBoolNo or eLazyBoolYes. +// LazyBool is for boolean values that need to be calculated lazily. Values +// start off set to eLazyBoolCalculate, and then they can be calculated once +// and set to eLazyBoolNo or eLazyBoolYes. //---------------------------------------------------------------------- typedef enum LazyBool { eLazyBoolCalculate = -1, @@ -217,8 +217,7 @@ enum class TypeValidatorResult : bool { Success = true, Failure = false }; //---------------------------------------------------------------------- -// Enumerations that can be used to specify scopes types when looking up -// types. +// Enumerations that can be used to specify scopes types when looking up types. //---------------------------------------------------------------------- enum class CompilerContextKind { Invalid = 0, @@ -235,8 +234,8 @@ }; //---------------------------------------------------------------------- -// Enumerations that can be used to specify the kind of metric we're -// looking at when collecting stats. +// Enumerations that can be used to specify the kind of metric we're looking at +// when collecting stats. //---------------------------------------------------------------------- enum StatisticKind { ExpressionSuccessful = 0, Index: lldb/trunk/include/lldb/lldb-private-forward.h =================================================================== --- lldb/trunk/include/lldb/lldb-private-forward.h +++ lldb/trunk/include/lldb/lldb-private-forward.h @@ -15,8 +15,8 @@ #include namespace lldb_private { -// --------------------------------------------------------------- -// Class forward decls. +// --------------------------------------------------------------- Class +// forward decls. // --------------------------------------------------------------- class NativeBreakpoint; class NativeBreakpointList; @@ -26,8 +26,7 @@ class ResumeActionList; class UnixSignals; -// --------------------------------------------------------------- -// SP/WP decls. +// --------------------------------------------------------------- SP/WP decls. // --------------------------------------------------------------- typedef std::shared_ptr NativeBreakpointSP; } Index: lldb/trunk/include/lldb/lldb-private-types.h =================================================================== --- lldb/trunk/include/lldb/lldb-private-types.h +++ lldb/trunk/include/lldb/lldb-private-types.h @@ -30,9 +30,8 @@ const lldb::DebuggerSP &debugger_sp, const FileSpec &spec, Status &error); //---------------------------------------------------------------------- -// Every register is described in detail including its name, alternate -// name (optional), encoding, size in bytes and the default display -// format. +// Every register is described in detail including its name, alternate name +// (optional), encoding, size in bytes and the default display format. //---------------------------------------------------------------------- struct RegisterInfo { const char *name; // Name of this register, can't be NULL @@ -41,28 +40,29 @@ uint32_t byte_offset; // The byte offset in the register context data where // this register's value is found. // This is optional, and can be 0 if a particular RegisterContext does not - // need to - // address its registers by byte offset. + // need to address its registers by byte offset. lldb::Encoding encoding; // Encoding of the register bits lldb::Format format; // Default display format uint32_t kinds[lldb::kNumRegisterKinds]; // Holds all of the various register // numbers for all register kinds uint32_t *value_regs; // List of registers (terminated with - // LLDB_INVALID_REGNUM). If this value is not - // null, all registers in this list will be read first, at which point the - // value - // for this register will be valid. For example, the value list for ah - // would be eax (x86) or rax (x64). + // LLDB_INVALID_REGNUM). If this value is not null, + // all registers in this list will be read first, at + // which point the value for this register will be + // valid. For example, the value list for ah would be + // eax (x86) or rax (x64). uint32_t *invalidate_regs; // List of registers (terminated with // LLDB_INVALID_REGNUM). If this value is not - // null, all registers in this list will be invalidated when the value of this - // register changes. For example, the invalidate list for eax would be rax - // ax, ah, and al. + // null, all registers in this list will be + // invalidated when the value of this register + // changes. For example, the invalidate list for + // eax would be rax ax, ah, and al. const uint8_t *dynamic_size_dwarf_expr_bytes; // A DWARF expression that when // evaluated gives // the byte size of this register. size_t dynamic_size_dwarf_len; // The length of the DWARF expression in bytes - // in the dynamic_size_dwarf_expr_bytes member. + // in the dynamic_size_dwarf_expr_bytes + // member. llvm::ArrayRef data(const uint8_t *context_base) const { return llvm::ArrayRef(context_base + byte_offset, byte_size); @@ -85,8 +85,8 @@ // values in this array are // *indices* (not register numbers) into a particular RegisterContext's // register array. For example, if eax is defined at index 4 for a - // particular RegisterContext, eax would be included in this RegisterSet - // by adding the value 4. Not by adding the value lldb_eax_i386. + // particular RegisterContext, eax would be included in this RegisterSet by + // adding the value 4. Not by adding the value lldb_eax_i386. }; struct OptionEnumValueElement { @@ -112,7 +112,8 @@ int short_option; // Single character for this option. int option_has_arg; // no_argument, required_argument or optional_argument OptionValidator *validator; // If non-NULL, option is valid iff - // |validator->IsValid()|, otherwise always valid. + // |validator->IsValid()|, otherwise always + // valid. OptionEnumValueElement *enum_values; // If non-NULL an array of enum values. uint32_t completion_type; // Cookie the option class can use to do define the // argument completion. Index: lldb/trunk/include/lldb/lldb-types.h =================================================================== --- lldb/trunk/include/lldb/lldb-types.h +++ lldb/trunk/include/lldb/lldb-types.h @@ -31,8 +31,8 @@ //---------------------------------------------------------------------- // TODO: Add a bunch of ifdefs to determine the host system and what -// things should be defined. Currently MacOSX is being assumed by default -// since that is what lldb was first developed for. +// things should be defined. Currently MacOSX is being assumed by default since +// that is what lldb was first developed for. #ifdef _WIN32 Index: lldb/trunk/include/lldb/lldb-versioning.h =================================================================== --- lldb/trunk/include/lldb/lldb-versioning.h +++ lldb/trunk/include/lldb/lldb-versioning.h @@ -100,8 +100,8 @@ */ // if you want the version checking to work on other OS/compiler, define -// appropriate IMPL_DEPRECATED/IMPL_TOONEW -// and define LLDB_API_CHECK_VERSIONING_WORKS when you are ready to go live +// appropriate IMPL_DEPRECATED/IMPL_TOONEW and define +// LLDB_API_CHECK_VERSIONING_WORKS when you are ready to go live #if defined(__APPLE__) && defined(__clang__) #define LLDB_API_IMPL_DEPRECATED __attribute__((deprecated)) #define LLDB_API_IMPL_TOONEW __attribute__((unavailable)) Index: lldb/trunk/source/API/SBAddress.cpp =================================================================== --- lldb/trunk/source/API/SBAddress.cpp +++ lldb/trunk/source/API/SBAddress.cpp @@ -120,10 +120,9 @@ else m_opaque_ap->Clear(); - // Check if we weren't were able to resolve a section offset address. - // If we weren't it is ok, the load address might be a location on the - // stack or heap, so we should just have an address with no section and - // a valid offset + // Check if we weren't were able to resolve a section offset address. If we + // weren't it is ok, the load address might be a location on the stack or + // heap, so we should just have an address with no section and a valid offset if (!m_opaque_ap->IsValid()) m_opaque_ap->SetOffset(load_addr); } @@ -163,9 +162,8 @@ } const Address &SBAddress::ref() const { - // This object should already have checked with "IsValid()" - // prior to calling this function. In case you didn't we will assert - // and die to let you know. + // This object should already have checked with "IsValid()" prior to calling + // this function. In case you didn't we will assert and die to let you know. assert(m_opaque_ap.get()); return *m_opaque_ap; } Index: lldb/trunk/source/API/SBBreakpointName.cpp =================================================================== --- lldb/trunk/source/API/SBBreakpointName.cpp +++ lldb/trunk/source/API/SBBreakpointName.cpp @@ -52,8 +52,8 @@ bool operator==(const SBBreakpointNameImpl &rhs); bool operator!=(const SBBreakpointNameImpl &rhs); - // For now we take a simple approach and only keep the name, and relook - // up the location when we need it. + // For now we take a simple approach and only keep the name, and relook up + // the location when we need it. TargetSP GetTarget() const { return m_target_wp.lock(); @@ -115,8 +115,7 @@ SBBreakpointName::SBBreakpointName(SBTarget &sb_target, const char *name) { m_impl_up.reset(new SBBreakpointNameImpl(sb_target, name)); - // Call FindBreakpointName here to make sure the name is valid, reset if - // not: + // Call FindBreakpointName here to make sure the name is valid, reset if not: BreakpointName *bp_name = GetBreakpointName(); if (!bp_name) m_impl_up.reset(); @@ -133,8 +132,7 @@ m_impl_up.reset(new SBBreakpointNameImpl(target.shared_from_this(), name)); - // Call FindBreakpointName here to make sure the name is valid, reset if - // not: + // Call FindBreakpointName here to make sure the name is valid, reset if not: BreakpointName *bp_name = GetBreakpointName(); if (!bp_name) { m_impl_up.reset(); Index: lldb/trunk/source/API/SBCommandInterpreter.cpp =================================================================== --- lldb/trunk/source/API/SBCommandInterpreter.cpp +++ lldb/trunk/source/API/SBCommandInterpreter.cpp @@ -272,8 +272,8 @@ 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. + // Sanity check the arguments that are passed in: cursor & last_char have to + // be within the current_line. if (current_line == nullptr || cursor == nullptr || last_char == nullptr) return 0; Index: lldb/trunk/source/API/SBDebugger.cpp =================================================================== --- lldb/trunk/source/API/SBDebugger.cpp +++ lldb/trunk/source/API/SBDebugger.cpp @@ -168,14 +168,10 @@ SBDebugger debugger; // Currently we have issues if this function is called simultaneously on two - // different - // threads. The issues mainly revolve around the fact that the - // lldb_private::FormatManager - // uses global collections and having two threads parsing the .lldbinit files - // can cause - // mayhem. So to get around this for now we need to use a mutex to prevent bad - // things - // from happening. + // different threads. The issues mainly revolve around the fact that the + // lldb_private::FormatManager uses global collections and having two threads + // parsing the .lldbinit files can cause mayhem. So to get around this for + // now we need to use a mutex to prevent bad things from happening. static std::recursive_mutex g_mutex; std::lock_guard guard(g_mutex); @@ -220,10 +216,10 @@ } void SBDebugger::MemoryPressureDetected() { - // Since this function can be call asynchronously, we allow it to be - // non-mandatory. We have seen deadlocks with this function when called - // so we need to safeguard against this until we can determine what is - // causing the deadlocks. + // Since this function can be call asynchronously, we allow it to be non- + // mandatory. We have seen deadlocks with this function when called so we + // need to safeguard against this until we can determine what is causing the + // deadlocks. Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); const bool mandatory = false; @@ -256,9 +252,9 @@ m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b); } -// Shouldn't really be settable after initialization as this could cause lots of -// problems; don't want users -// trying to switch modes in the middle of a debugging session. +// Shouldn't really be settable after initialization as this could cause lots +// of problems; don't want users trying to switch modes in the middle of a +// debugging session. void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); Index: lldb/trunk/source/API/SBEvent.cpp =================================================================== --- lldb/trunk/source/API/SBEvent.cpp +++ lldb/trunk/source/API/SBEvent.cpp @@ -146,8 +146,8 @@ } bool SBEvent::IsValid() const { - // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() - // accessor. See comments in SBEvent::get().... + // Do NOT use m_opaque_ptr directly!!! Must use the SBEvent::get() accessor. + // See comments in SBEvent::get().... return SBEvent::get() != NULL; } Index: lldb/trunk/source/API/SBInstruction.cpp =================================================================== --- lldb/trunk/source/API/SBInstruction.cpp +++ lldb/trunk/source/API/SBInstruction.cpp @@ -27,12 +27,11 @@ #include "lldb/Utility/DataExtractor.h" //---------------------------------------------------------------------- -// We recently fixed a leak in one of the Instruction subclasses where -// the instruction will only hold a weak reference to the disassembler -// to avoid a cycle that was keeping both objects alive (leak) and we -// need the InstructionImpl class to make sure our public API behaves -// as users would expect. Calls in our public API allow clients to do -// things like: +// We recently fixed a leak in one of the Instruction subclasses where the +// instruction will only hold a weak reference to the disassembler to avoid a +// cycle that was keeping both objects alive (leak) and we need the +// InstructionImpl class to make sure our public API behaves as users would +// expect. Calls in our public API allow clients to do things like: // // 1 lldb::SBInstruction inst; // 2 inst = target.ReadInstructions(pc, 1).GetInstructionAtIndex(0) @@ -40,12 +39,12 @@ // 4 ... // // There was a temporary lldb::DisassemblerSP object created in the -// SBInstructionList that was returned by lldb.target.ReadInstructions() -// that will go away after line 2 but the "inst" object should be able -// to still answer questions about itself. So we make sure that any -// SBInstruction objects that are given out have a strong reference to -// the disassembler and the instruction so that the object can live and -// successfully respond to all queries. +// SBInstructionList that was returned by lldb.target.ReadInstructions() that +// will go away after line 2 but the "inst" object should be able to still +// answer questions about itself. So we make sure that any SBInstruction +// objects that are given out have a strong reference to the disassembler and +// the instruction so that the object can live and successfully respond to all +// queries. //---------------------------------------------------------------------- class InstructionImpl { public: Index: lldb/trunk/source/API/SBInstructionList.cpp =================================================================== --- lldb/trunk/source/API/SBInstructionList.cpp +++ lldb/trunk/source/API/SBInstructionList.cpp @@ -92,8 +92,8 @@ if (m_opaque_sp) { size_t num_instructions = GetSize(); if (num_instructions) { - // Call the ref() to make sure a stream is created if one deesn't - // exist already inside description... + // Call the ref() to make sure a stream is created if one deesn't exist + // already inside description... Stream &sref = description.ref(); const uint32_t max_opcode_byte_size = m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize(); Index: lldb/trunk/source/API/SBLaunchInfo.cpp =================================================================== --- lldb/trunk/source/API/SBLaunchInfo.cpp +++ lldb/trunk/source/API/SBLaunchInfo.cpp @@ -148,8 +148,8 @@ } const char *SBLaunchInfo::GetShell() { - // Constify this string so that it is saved in the string pool. Otherwise - // it would be freed when this function goes out of scope. + // Constify this string so that it is saved in the string pool. Otherwise it + // would be freed when this function goes out of scope. ConstString shell(m_opaque_sp->GetShell().GetPath().c_str()); return shell.AsCString(); } Index: lldb/trunk/source/API/SBModule.cpp =================================================================== --- lldb/trunk/source/API/SBModule.cpp +++ lldb/trunk/source/API/SBModule.cpp @@ -165,11 +165,10 @@ const char *uuid_cstr = NULL; ModuleSP module_sp(GetSP()); if (module_sp) { - // We are going to return a "const char *" value through the public - // API, so we need to constify it so it gets added permanently the - // string pool and then we don't need to worry about the lifetime of the - // string as it will never go away once it has been put into the ConstString - // string pool + // We are going to return a "const char *" value through the public API, so + // we need to constify it so it gets added permanently the string pool and + // then we don't need to worry about the lifetime of the string as it will + // never go away once it has been put into the ConstString string pool uuid_cstr = ConstString(module_sp->GetUUID().GetAsString()).GetCString(); } @@ -515,9 +514,9 @@ ModuleSP module_sp(GetSP()); if (module_sp) { std::string triple(module_sp->GetArchitecture().GetTriple().str()); - // Unique the string so we don't run into ownership issues since - // the const strings put the string into the string pool once and - // the strings never comes out + // Unique the string so we don't run into ownership issues since the const + // strings put the string into the string pool once and the strings never + // comes out ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } Index: lldb/trunk/source/API/SBModuleSpec.cpp =================================================================== --- lldb/trunk/source/API/SBModuleSpec.cpp +++ lldb/trunk/source/API/SBModuleSpec.cpp @@ -70,9 +70,9 @@ const char *SBModuleSpec::GetTriple() { std::string triple(m_opaque_ap->GetArchitecture().GetTriple().str()); - // Unique the string so we don't run into ownership issues since - // the const strings put the string into the string pool once and - // the strings never comes out + // Unique the string so we don't run into ownership issues since the const + // strings put the string into the string pool once and the strings never + // comes out ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } Index: lldb/trunk/source/API/SBProcess.cpp =================================================================== --- lldb/trunk/source/API/SBProcess.cpp +++ lldb/trunk/source/API/SBProcess.cpp @@ -896,8 +896,7 @@ ProcessSP process_sp = Process::ProcessEventData::GetProcessFromEvent(event.get()); if (!process_sp) { - // StructuredData events also know the process they come from. - // Try that. + // StructuredData events also know the process they come from. Try that. process_sp = EventDataStructuredData::GetProcessFromEvent(event.get()); } Index: lldb/trunk/source/API/SBQueueItem.cpp =================================================================== --- lldb/trunk/source/API/SBQueueItem.cpp +++ lldb/trunk/source/API/SBQueueItem.cpp @@ -112,8 +112,7 @@ thread_sp = m_queue_item_sp->GetExtendedBacktraceThread(type_const); if (thread_sp) { // Save this in the Process' ExtendedThreadList so a strong pointer - // retains the - // object + // retains the object process_sp->GetExtendedThreadList().AddThread(thread_sp); result.SetThread(thread_sp); if (log) { Index: lldb/trunk/source/API/SBStream.cpp =================================================================== --- lldb/trunk/source/API/SBStream.cpp +++ lldb/trunk/source/API/SBStream.cpp @@ -26,8 +26,8 @@ bool SBStream::IsValid() const { return (m_opaque_ap.get() != NULL); } -// If this stream is not redirected to a file, it will maintain a local -// cache for the stream data which can be accessed using this accessor. +// If this stream is not redirected to a file, it will maintain a local cache +// for the stream data which can be accessed using this accessor. const char *SBStream::GetData() { if (m_is_file || m_opaque_ap.get() == NULL) return NULL; @@ -35,9 +35,8 @@ return static_cast(m_opaque_ap.get())->GetData(); } -// If this stream is not redirected to a file, it will maintain a local -// cache for the stream output whose length can be accessed using this -// accessor. +// If this stream is not redirected to a file, it will maintain a local cache +// for the stream output whose length can be accessed using this accessor. size_t SBStream::GetSize() { if (m_is_file || m_opaque_ap.get() == NULL) return 0; Index: lldb/trunk/source/API/SBTarget.cpp =================================================================== --- lldb/trunk/source/API/SBTarget.cpp +++ lldb/trunk/source/API/SBTarget.cpp @@ -84,8 +84,8 @@ const auto state = process_sp->GetState(); if (process_sp->IsAlive() && state == eStateConnected) { // If we are already connected, then we have already specified the - // listener, so if a valid listener is supplied, we need to error out - // to let the client know. + // listener, so if a valid listener is supplied, we need to error out to + // let the client know. if (attach_info.GetListener()) return Status("process is connected and already has a listener, pass " "empty listener"); @@ -288,8 +288,8 @@ if (state == eStateConnected) { // If we are already connected, then we have already specified the - // listener, so if a valid listener is supplied, we need to error out - // to let the client know. + // listener, so if a valid listener is supplied, we need to error out to + // let the client know. if (listener.IsValid()) { error.SetErrorString("process is connected and already has a listener, " "pass empty listener"); @@ -1543,9 +1543,9 @@ TargetSP target_sp(GetSP()); if (target_sp) { std::string triple(target_sp->GetArchitecture().GetTriple().str()); - // Unique the string so we don't run into ownership issues since - // the const strings put the string into the string pool once and - // the strings never comes out + // Unique the string so we don't run into ownership issues since the const + // strings put the string into the string pool once and the strings never + // comes out ConstString const_triple(triple.c_str()); return const_triple.GetCString(); } @@ -1695,8 +1695,8 @@ } } - // Didn't find the type in the symbols; try the Objective-C runtime - // if one is installed + // Didn't find the type in the symbols; try the Objective-C runtime if one + // is installed ProcessSP process_sp(target_sp->GetProcessSP()); Index: lldb/trunk/source/API/SBThread.cpp =================================================================== --- lldb/trunk/source/API/SBThread.cpp +++ lldb/trunk/source/API/SBThread.cpp @@ -615,8 +615,7 @@ } // User level plans should be Master Plans so they can be interrupted, other - // plans executed, and - // then a "continue" will resume the plan. + // plans executed, and then a "continue" will resume the plan. if (new_plan != NULL) { new_plan->SetIsMasterPlan(true); new_plan->SetOkayToDiscard(false); @@ -911,8 +910,7 @@ // 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. + // appropriate error message. bool all_in_function = true; AddressRange fun_range = frame_sc.function->GetAddressRange(); @@ -1374,8 +1372,7 @@ runtime->GetExtendedBacktraceThread(real_thread, type_const)); if (new_thread_sp) { // Save this in the Process' ExtendedThreadList so a strong - // pointer retains the - // object. + // pointer retains the object. process->GetExtendedThreadList().AddThread(new_thread_sp); sb_origin_thread.SetThread(new_thread_sp); if (log) { Index: lldb/trunk/source/API/SBThreadPlan.cpp =================================================================== --- lldb/trunk/source/API/SBThreadPlan.cpp +++ lldb/trunk/source/API/SBThreadPlan.cpp @@ -138,8 +138,7 @@ // plans... // // FIXME, you should only be able to queue thread plans from inside the methods -// of a -// Scripted Thread Plan. Need a way to enforce that. +// of a Scripted Thread Plan. Need a way to enforce that. SBThreadPlan SBThreadPlan::QueueThreadPlanForStepOverRange(SBAddress &sb_start_address, Index: lldb/trunk/source/API/SBType.cpp =================================================================== --- lldb/trunk/source/API/SBType.cpp +++ lldb/trunk/source/API/SBType.cpp @@ -88,9 +88,9 @@ } const TypeImpl &SBType::ref() const { - // "const SBAddress &addr" should already have checked "addr.IsValid()" - // prior to calling this function. In case you didn't we will assert - // and die to let you know. + // "const SBAddress &addr" should already have checked "addr.IsValid()" prior + // to calling this function. In case you didn't we will assert and die to let + // you know. assert(m_opaque_sp.get()); return *m_opaque_sp; } Index: lldb/trunk/source/API/SBTypeCategory.cpp =================================================================== --- lldb/trunk/source/API/SBTypeCategory.cpp +++ lldb/trunk/source/API/SBTypeCategory.cpp @@ -341,9 +341,9 @@ // FIXME: we need to iterate over all the Debugger objects and have each of // them contain a copy of the function // since we currently have formatters live in a global space, while Python - // code lives in a specific Debugger-related environment - // this should eventually be fixed by deciding a final location in the LLDB - // object space for formatters + // code lives in a specific Debugger-related environment this should + // eventually be fixed by deciding a final location in the LLDB object space + // for formatters if (summary.IsFunctionCode()) { const void *name_token = (const void *)ConstString(type_name.GetName()).GetCString(); @@ -453,9 +453,9 @@ // FIXME: we need to iterate over all the Debugger objects and have each of // them contain a copy of the function // since we currently have formatters live in a global space, while Python - // code lives in a specific Debugger-related environment - // this should eventually be fixed by deciding a final location in the LLDB - // object space for formatters + // code lives in a specific Debugger-related environment this should + // eventually be fixed by deciding a final location in the LLDB object space + // for formatters if (synth.IsClassCode()) { const void *name_token = (const void *)ConstString(type_name.GetName()).GetCString(); Index: lldb/trunk/source/API/SBValue.cpp =================================================================== --- lldb/trunk/source/API/SBValue.cpp +++ lldb/trunk/source/API/SBValue.cpp @@ -89,16 +89,13 @@ // FIXME: This check is necessary but not sufficient. We for sure don't // want to touch SBValues whose owning // targets have gone away. This check is a little weak in that it - // enforces that restriction when you call - // IsValid, but since IsValid doesn't lock the target, you have no - // guarantee that the SBValue won't go - // invalid after you call this... - // Also, an SBValue could depend on data from one of the modules in the - // target, and those could go away - // independently of the target, for instance if a module is unloaded. But - // right now, neither SBValues - // nor ValueObjects know which modules they depend on. So I have no good - // way to make that check without + // enforces that restriction when you call IsValid, but since IsValid + // doesn't lock the target, you have no guarantee that the SBValue won't + // go invalid after you call this... Also, an SBValue could depend on + // data from one of the modules in the target, and those could go away + // independently of the target, for instance if a module is unloaded. + // But right now, neither SBValues nor ValueObjects know which modules + // they depend on. So I have no good way to make that check without // tracking that in all the ValueObject subclasses. TargetSP target_sp = m_valobj_sp->GetTargetSP(); if (target_sp && target_sp->IsValid()) @@ -129,9 +126,9 @@ 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. + // 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", static_cast(value_sp.get())); @@ -171,10 +168,8 @@ // 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 - // provide simple accessors for these, which I do here. + // calculations in GetSP to return the Target, Process, Thread or Frame. It + // is convenient to provide simple accessors for these, which I do here. TargetSP GetTargetSP() { if (m_valobj_sp) return m_valobj_sp->GetTargetSP(); @@ -242,9 +237,9 @@ SBValue::~SBValue() {} bool SBValue::IsValid() { - // If this function ever changes to anything that does more than just - // check if the opaque shared pointer is non NULL, then we need to update - // all "if (m_opaque_sp)" code in this file. + // If this function ever changes to anything that does more than just check + // if the opaque shared pointer is non NULL, then we need to update all "if + // (m_opaque_sp)" code in this file. return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid() && m_opaque_sp->GetRootSP().get() != NULL; } @@ -1397,11 +1392,9 @@ if (module_sp) module_sp->ResolveFileAddress(value, addr); } else if (addr_type == eAddressTypeLoad) { - // no need to check the return value on this.. if it can actually do the - // resolve - // addr will be in the form (section,offset), otherwise it will simply - // be returned - // as (NULL, value) + // no need to check the return value on this.. if it can actually do + // the resolve addr will be in the form (section,offset), otherwise it + // will simply be returned as (NULL, value) addr.SetLoadAddress(value, target_sp.get()); } } Index: lldb/trunk/source/API/SystemInitializerFull.cpp =================================================================== --- lldb/trunk/source/API/SystemInitializerFull.cpp +++ lldb/trunk/source/API/SystemInitializerFull.cpp @@ -138,11 +138,10 @@ #define LLDBSwigPyInit init_lldb #endif -// these are the Pythonic implementations of the required callbacks -// these are scripting-language specific, which is why they belong here -// we still need to use function pointers to them instead of relying -// on linkage-time resolution because the SWIG stuff and this file -// get built at different times +// these are the Pythonic implementations of the required callbacks these are +// scripting-language specific, which is why they belong here we still need to +// use function pointers to them instead of relying on linkage-time resolution +// because the SWIG stuff and this file get built at different times extern "C" bool LLDBSwigPythonBreakpointCallbackFunction( const char *python_function_name, const char *session_dictionary_name, const lldb::StackFrameSP &sb_frame, @@ -262,10 +261,9 @@ #if !defined(LLDB_DISABLE_PYTHON) InitializeSWIG(); - // ScriptInterpreterPython::Initialize() depends on things like HostInfo being - // initialized - // so it can compute the python directory etc, so we need to do this after - // SystemInitializerCommon::Initialize(). + // ScriptInterpreterPython::Initialize() depends on things like HostInfo + // being initialized so it can compute the python directory etc, so we need + // to do this after SystemInitializerCommon::Initialize(). ScriptInterpreterPython::Initialize(); #endif @@ -363,8 +361,8 @@ DynamicLoaderDarwinKernel::Initialize(); #endif - // This plugin is valid on any host that talks to a Darwin remote. - // It shouldn't be limited to __APPLE__. + // This plugin is valid on any host that talks to a Darwin remote. It + // shouldn't be limited to __APPLE__. StructuredDataDarwinLog::Initialize(); //---------------------------------------------------------------------- @@ -382,8 +380,8 @@ // Scan for any system or user LLDB plug-ins PluginManager::Initialize(); - // The process settings need to know about installed plug-ins, so the Settings - // must be initialized + // The process settings need to know about installed plug-ins, so the + // Settings must be initialized // AFTER PluginManager::Initialize is called. Debugger::SettingsInitialize(); Index: lldb/trunk/source/Breakpoint/Breakpoint.cpp =================================================================== --- lldb/trunk/source/Breakpoint/Breakpoint.cpp +++ lldb/trunk/source/Breakpoint/Breakpoint.cpp @@ -285,13 +285,13 @@ m_locations.RemoveInvalidLocations(arch); } -// For each of the overall options we need to decide how they propagate to -// the location options. This will determine the precedence of options on -// the breakpoint vs. its locations. - -// Disable at the breakpoint level should override the location settings. -// That way you can conveniently turn off a whole breakpoint without messing -// up the individual settings. +// For each of the overall options we need to decide how they propagate to the +// location options. This will determine the precedence of options on the +// breakpoint vs. its locations. + +// Disable at the breakpoint level should override the location settings. That +// way you can conveniently turn off a whole breakpoint without messing up the +// individual settings. void Breakpoint::SetEnabled(bool enable) { if (enable == m_options_up->IsEnabled()) @@ -331,10 +331,8 @@ uint32_t ignore = GetIgnoreCount(); if (ignore != 0) { // When we get here we know the location that caused the stop doesn't have - // an ignore count, - // since by contract we call it first... So we don't have to find & - // decrement it, we only have - // to decrement our own ignore count. + // an ignore count, since by contract we call it first... So we don't have + // to find & decrement it, we only have to decrement our own ignore count. DecrementIgnoreCount(); return false; } else @@ -431,8 +429,8 @@ // This function is used when "baton" doesn't need to be freed void Breakpoint::SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous) { - // The default "Baton" class will keep a copy of "baton" and won't free - // or delete it when it goes goes out of scope. + // The default "Baton" class will keep a copy of "baton" and won't free or + // delete it when it goes goes out of scope. m_options_up->SetCallback(callback, std::make_shared(baton), is_synchronous); @@ -478,8 +476,7 @@ bool send_event) { if (m_resolver_sp) { // If this is not an internal breakpoint, set up to record the new - // locations, then dispatch - // an event with the new locations. + // locations, then dispatch an event with the new locations. if (!IsInternal() && send_event) { BreakpointEventData *new_locations_event = new BreakpointEventData( eBreakpointEventTypeLocationsAdded, shared_from_this()); @@ -517,8 +514,8 @@ std::lock_guard guard(module_list.GetMutex()); if (load) { // The logic for handling new modules is: - // 1) If the filter rejects this module, then skip it. - // 2) Run through the current location list and if there are any locations + // 1) If the filter rejects this module, then skip it. 2) Run through the + // current location list and if there are any locations // for that module, we mark the module as "seen" and we don't try to // re-resolve // breakpoint locations for that module. @@ -528,8 +525,8 @@ ModuleList new_modules; // We'll stuff the "unseen" modules in this list, // and then resolve - // them after the locations pass. Have to do it this way because - // resolving breakpoints will add new locations potentially. + // them after the locations pass. Have to do it this way because resolving + // breakpoints will add new locations potentially. for (ModuleSP module_sp : module_list.ModulesNoLocking()) { bool seen = false; @@ -540,9 +537,9 @@ for (BreakpointLocationSP break_loc_sp : m_locations.BreakpointLocations()) { - // If the section for this location was deleted, that means - // it's Module has gone away but somebody forgot to tell us. - // Let's clean it up here. + // If the section for this location was deleted, that means it's Module + // has gone away but somebody forgot to tell us. Let's clean it up + // here. Address section_addr(break_loc_sp->GetAddress()); if (section_addr.SectionWasDeleted()) { locations_with_no_section.Add(break_loc_sp); @@ -554,10 +551,10 @@ SectionSP section_sp(section_addr.GetSection()); - // If we don't have a Section, that means this location is a raw address - // that we haven't resolved to a section yet. So we'll have to look - // in all the new modules to resolve this location. - // Otherwise, if it was set in this module, re-resolve it here. + // If we don't have a Section, that means this location is a raw + // address that we haven't resolved to a section yet. So we'll have to + // look in all the new modules to resolve this location. Otherwise, if + // it was set in this module, re-resolve it here. if (section_sp && section_sp->GetModule() == module_sp) { if (!seen) seen = true; @@ -606,10 +603,9 @@ BreakpointLocationSP break_loc_sp(m_locations.GetByIndex(loc_idx)); SectionSP section_sp(break_loc_sp->GetAddress().GetSection()); if (section_sp && section_sp->GetModule() == module_sp) { - // Remove this breakpoint since the shared library is - // unloaded, but keep the breakpoint location around - // so we always get complete hit count and breakpoint - // lifetime info + // Remove this breakpoint since the shared library is unloaded, but + // keep the breakpoint location around so we always get complete + // hit count and breakpoint lifetime info break_loc_sp->ClearBreakpointSite(); if (removed_locations_event) { removed_locations_event->GetBreakpointLocationCollection().Add( @@ -637,7 +633,8 @@ bool equivalent_scs = false; if (old_sc.module_sp.get() == new_sc.module_sp.get()) { - // If these come from the same module, we can directly compare the pointers: + // If these come from the same module, we can directly compare the + // pointers: if (old_sc.comp_unit && new_sc.comp_unit && (old_sc.comp_unit == new_sc.comp_unit)) { if (old_sc.function && new_sc.function && @@ -694,15 +691,13 @@ temp_list.Append(new_module_sp); ResolveBreakpointInModules(temp_list); } else { - // First search the new module for locations. - // Then compare this with the old list, copy over locations that "look the - // same" - // Then delete the old locations. - // Finally remember to post the creation event. + // First search the new module for locations. Then compare this with the + // old list, copy over locations that "look the same" Then delete the old + // locations. Finally remember to post the creation event. // - // Two locations are the same if they have the same comp unit & function (by - // name) and there are the same number - // of locations in the old function as in the new one. + // Two locations are the same if they have the same comp unit & function + // (by name) and there are the same number of locations in the old function + // as in the new one. ModuleList temp_list; temp_list.Append(new_module_sp); @@ -715,8 +710,8 @@ if (num_new_locations > 0) { // Break out the case of one location -> one location since that's the - // most common one, and there's no need - // to build up the structures needed for the merge in that case. + // most common one, and there's no need to build up the structures needed + // for the merge in that case. if (num_new_locations == 1 && num_old_locations == 1) { bool equivalent_locations = false; SymbolContext old_sc, new_sc; @@ -739,8 +734,7 @@ } } else { // We don't want to have to keep computing the SymbolContexts for these - // addresses over and over, - // so lets get them up front: + // addresses over and over, so lets get them up front: typedef std::map IDToSCMap; IDToSCMap old_sc_map; @@ -763,7 +757,8 @@ lldb::break_id_t old_id = old_sc_map.begin()->first; SymbolContext &old_sc = old_sc_map.begin()->second; - // Count the number of entries equivalent to this SC for the old list: + // Count the number of entries equivalent to this SC for the old + // list: std::vector old_id_vec; old_id_vec.push_back(old_id); @@ -783,13 +778,11 @@ } // Alright, if we have the same number of potentially equivalent - // locations in the old - // and new modules, we'll just map them one to one in ascending ID - // order (assuming the - // resolver's order would match the equivalent ones. - // Otherwise, we'll dump all the old ones, and just take the new ones, - // erasing the elements - // from both maps as we go. + // locations in the old and new modules, we'll just map them one to + // one in ascending ID order (assuming the resolver's order would + // match the equivalent ones. Otherwise, we'll dump all the old ones, + // and just take the new ones, erasing the elements from both maps as + // we go. if (old_id_vec.size() == new_id_vec.size()) { llvm::sort(old_id_vec.begin(), old_id_vec.end()); @@ -821,11 +814,9 @@ } // Now remove the remaining old locations, and cons up a removed locations - // event. - // Note, we don't put the new locations that were swapped with an old - // location on the locations_to_remove - // list, so we don't need to worry about telling the world about removing a - // location we didn't tell them + // event. Note, we don't put the new locations that were swapped with an + // old location on the locations_to_remove list, so we don't need to worry + // about telling the world about removing a location we didn't tell them // about adding. BreakpointEventData *locations_event; @@ -861,8 +852,8 @@ void Breakpoint::Dump(Stream *) {} size_t Breakpoint::GetNumResolvedLocations() const { - // Return the number of breakpoints that are actually resolved and set - // down in the inferior process. + // Return the number of breakpoints that are actually resolved and set down + // in the inferior process. return m_locations.GetNumResolvedLocations(); } @@ -889,9 +880,8 @@ const size_t num_resolved_locations = GetNumResolvedLocations(); // They just made the breakpoint, they don't need to be told HOW they made - // it... - // Also, we'll print the breakpoint number differently depending on whether - // there is 1 or more locations. + // it... Also, we'll print the breakpoint number differently depending on + // whether there is 1 or more locations. if (level != eDescriptionLevelInitial) { s->Printf("%i: ", GetID()); GetResolverDescription(s); @@ -908,8 +898,7 @@ (uint64_t)num_resolved_locations, GetHitCount()); } else { // Don't print the pending notification for exception resolvers since we - // don't generally - // know how to set them until the target is run. + // don't generally know how to set them until the target is run. if (m_resolver_sp->getResolverID() != BreakpointResolver::ExceptionResolver) s->Printf(", locations = 0 (pending)"); @@ -965,8 +954,7 @@ } // The brief description is just the location name (1.2 or whatever). That's - // pointless to - // show in the breakpoint's description, so suppress it. + // pointless to show in the breakpoint's description, so suppress it. if (show_locations && level != lldb::eDescriptionLevelBrief) { s->IndentMore(); for (size_t i = 0; i < num_locations; ++i) { Index: lldb/trunk/source/Breakpoint/BreakpointID.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointID.cpp +++ lldb/trunk/source/Breakpoint/BreakpointID.cpp @@ -29,10 +29,9 @@ static llvm::StringRef g_range_specifiers[] = {"-", "to", "To", "TO"}; // Tells whether or not STR is valid to use between two strings representing -// breakpoint IDs, to -// indicate a range of breakpoint IDs. This is broken out into a separate -// function so that we can -// easily change or add to the format for specifying ID ranges at a later date. +// breakpoint IDs, to indicate a range of breakpoint IDs. This is broken out +// into a separate function so that we can easily change or add to the format +// for specifying ID ranges at a later date. bool BreakpointID::IsRangeIdentifier(llvm::StringRef str) { for (auto spec : g_range_specifiers) { Index: lldb/trunk/source/Breakpoint/BreakpointIDList.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointIDList.cpp +++ lldb/trunk/source/Breakpoint/BreakpointIDList.cpp @@ -237,13 +237,13 @@ } // We have valid range starting & ending breakpoint IDs. Go through all - // the breakpoints in the target and find all the breakpoints that fit - // into this range, and add them to new_args. + // the breakpoints in the target and find all the breakpoints that fit into + // this range, and add them to new_args. // Next check to see if we have location id's. If so, make sure the - // start_bp_id and end_bp_id are for the same breakpoint; otherwise we - // have an illegal range: breakpoint id ranges that specify bp locations - // are NOT allowed to cross major bp id numbers. + // start_bp_id and end_bp_id are for the same breakpoint; otherwise we have + // an illegal range: breakpoint id ranges that specify bp locations are NOT + // allowed to cross major bp id numbers. if ((start_loc_id != LLDB_INVALID_BREAK_ID) || (end_loc_id != LLDB_INVALID_BREAK_ID)) { Index: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp +++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp @@ -110,8 +110,8 @@ if (thread_id != LLDB_INVALID_THREAD_ID) GetLocationOptions()->SetThreadID(thread_id); else { - // If we're resetting this to an invalid thread id, then - // don't make an options pointer just to do that. + // If we're resetting this to an invalid thread id, then don't make an + // options pointer just to do that. if (m_options_ap.get() != nullptr) m_options_ap->SetThreadID(thread_id); } @@ -132,8 +132,8 @@ if (index != 0) GetLocationOptions()->GetThreadSpec()->SetIndex(index); else { - // If we're resetting this to an invalid thread id, then - // don't make an options pointer just to do that. + // If we're resetting this to an invalid thread id, then don't make an + // options pointer just to do that. if (m_options_ap.get() != nullptr) m_options_ap->GetThreadSpec()->SetIndex(index); } @@ -154,8 +154,8 @@ if (thread_name != nullptr) GetLocationOptions()->GetThreadSpec()->SetName(thread_name); else { - // If we're resetting this to an invalid thread id, then - // don't make an options pointer just to do that. + // If we're resetting this to an invalid thread id, then don't make an + // options pointer just to do that. if (m_options_ap.get() != nullptr) m_options_ap->GetThreadSpec()->SetName(thread_name); } @@ -176,8 +176,8 @@ if (queue_name != nullptr) GetLocationOptions()->GetThreadSpec()->SetQueueName(queue_name); else { - // If we're resetting this to an invalid thread id, then - // don't make an options pointer just to do that. + // If we're resetting this to an invalid thread id, then don't make an + // options pointer just to do that. if (m_options_ap.get() != nullptr) m_options_ap->GetThreadSpec()->SetQueueName(queue_name); } @@ -203,8 +203,8 @@ void BreakpointLocation::SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous) { - // The default "Baton" class will keep a copy of "baton" and won't free - // or delete it when it goes goes out of scope. + // The default "Baton" class will keep a copy of "baton" and won't free or + // delete it when it goes goes out of scope. GetLocationOptions()->SetCallback( callback, std::make_shared(baton), is_synchronous); SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged); @@ -283,8 +283,7 @@ } // We need to make sure the user sees any parse errors in their condition, so - // we'll hook the - // constructor errors up to the debugger's Async I/O. + // we'll hook the constructor errors up to the debugger's Async I/O. ValueObjectSP result_value_sp; @@ -372,9 +371,9 @@ } BreakpointOptions *BreakpointLocation::GetLocationOptions() { - // If we make the copy we don't copy the callbacks because that is potentially - // expensive and we don't want to do that for the simple case where someone is - // just disabling the location. + // If we make the copy we don't copy the callbacks because that is + // potentially expensive and we don't want to do that for the simple case + // where someone is just disabling the location. if (m_options_ap.get() == nullptr) m_options_ap.reset( new BreakpointOptions(false)); @@ -479,9 +478,8 @@ if (m_bp_site_sp.get()) { ProcessSP process_sp(m_owner.GetTarget().GetProcessSP()); // If the process exists, get it to remove the owner, it will remove the - // physical implementation - // of the breakpoint as well if there are no more owners. Otherwise just - // remove this owner. + // physical implementation of the breakpoint as well if there are no more + // owners. Otherwise just remove this owner. if (process_sp) process_sp->RemoveOwnerFromBreakpointSite(GetBreakpoint().GetID(), GetID(), m_bp_site_sp); @@ -499,8 +497,8 @@ SymbolContext sc; // If the description level is "initial" then the breakpoint is printing out - // our initial state, - // and we should let it decide how it wants to print our label. + // our initial state, and we should let it decide how it wants to print our + // label. if (level != eDescriptionLevelInitial) { s->Indent(); BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID()); Index: lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp +++ lldb/trunk/source/Breakpoint/BreakpointLocationList.cpp @@ -49,12 +49,12 @@ BreakpointLocationSP bp = FindByID(break_id); if (bp) { // Let the BreakpointLocation decide if it should stop here (could not have - // reached it's target hit count yet, or it could have a callback - // that decided it shouldn't stop (shared library loads/unloads). + // reached it's target hit count yet, or it could have a callback that + // decided it shouldn't stop (shared library loads/unloads). return bp->ShouldStop(context); } - // We should stop here since this BreakpointLocation isn't valid anymore or it - // doesn't exist. + // We should stop here since this BreakpointLocation isn't valid anymore or + // it doesn't exist. return true; } @@ -266,8 +266,8 @@ void BreakpointLocationList::RemoveInvalidLocations(const ArchSpec &arch) { std::lock_guard guard(m_mutex); size_t idx = 0; - // Don't cache m_location.size() as it will change since we might - // remove locations from our vector... + // Don't cache m_location.size() as it will change since we might remove + // locations from our vector... while (idx < m_locations.size()) { BreakpointLocation *bp_loc = m_locations[idx].get(); if (bp_loc->GetAddress().SectionWasDeleted()) { @@ -287,7 +287,8 @@ } } } - // Only increment the index if we didn't remove the locations at index "idx" + // Only increment the index if we didn't remove the locations at index + // "idx" ++idx; } } Index: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp +++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp @@ -425,10 +425,9 @@ const lldb::BatonSP &callback_baton_sp, bool callback_is_synchronous) { // FIXME: This seems unsafe. If BatonSP actually *is* a CommandBaton, but - // in a shared_ptr instead of a shared_ptr, then we - // will set m_baton_is_command_baton to false, which is incorrect. - // One possible solution is to make the base Baton class provide a method - // such as: + // in a shared_ptr instead of a shared_ptr, then we will + // set m_baton_is_command_baton to false, which is incorrect. One possible + // solution is to make the base Baton class provide a method such as: // virtual StringRef getBatonId() const { return ""; } // and have CommandBaton override this to return something unique, and then // check for it here. Another option might be to make Baton using the llvm @@ -554,8 +553,7 @@ void BreakpointOptions::GetDescription(Stream *s, lldb::DescriptionLevel level) const { // Figure out if there are any options not at their default value, and only - // print - // anything if there are: + // print anything if there are: if (m_ignore_count != 0 || !m_enabled || m_one_shot || m_auto_continue || (GetThreadSpecNoCreate() != nullptr && @@ -660,8 +658,7 @@ CommandReturnObject result; Debugger &debugger = target->GetDebugger(); // Rig up the results secondary output stream to the debugger's, so the - // output will come out synchronously - // if the debugger is set up that way. + // output will come out synchronously if the debugger is set up that way. StreamSP output_stream(debugger.GetAsyncOutputStream()); StreamSP error_stream(debugger.GetAsyncErrorStream()); Index: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp @@ -15,8 +15,8 @@ // Project includes #include "lldb/Breakpoint/Breakpoint.h" #include "lldb/Breakpoint/BreakpointLocation.h" -// Have to include the other breakpoint resolver types here so the static create -// from StructuredData can call them. +// Have to include the other breakpoint resolver types here so the static +// create from StructuredData can call them. #include "lldb/Breakpoint/BreakpointResolverAddress.h" #include "lldb/Breakpoint/BreakpointResolverFileLine.h" #include "lldb/Breakpoint/BreakpointResolverFileRegex.h" @@ -212,8 +212,7 @@ sc_list.RemoveContextAtIndex(current_idx); // ResolveSymbolContext will always return a number that is >= the line - // number you pass in. - // So the smaller line number is always better. + // number you pass in. So the smaller line number is always better. if (sc.line_entry.line < closest_line_number) closest_line_number = sc.line_entry.line; } else @@ -234,8 +233,7 @@ } // Next go through and see if there are line table entries that are - // contiguous, and if so keep only the - // first of the contiguous range: + // contiguous, and if so keep only the first of the contiguous range: current_idx = 0; std::map blocks_with_breakpoints; Index: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp @@ -100,11 +100,10 @@ } void BreakpointResolverAddress::ResolveBreakpoint(SearchFilter &filter) { - // If the address is not section relative, then we should not try to - // re-resolve it, it is just some - // random address and we wouldn't know what to do on reload. But if it is - // section relative, we need to - // re-resolve it since the section it's in may have shifted on re-run. + // If the address is not section relative, then we should not try to re- + // resolve it, it is just some random address and we wouldn't know what to do + // on reload. But if it is section relative, we need to re-resolve it since + // the section it's in may have shifted on re-run. bool re_resolve = false; if (m_addr.GetSection() || m_module_filespec) re_resolve = true; @@ -137,8 +136,8 @@ if (filter.AddressPasses(m_addr)) { if (m_breakpoint->GetNumLocations() == 0) { // If the address is just an offset, and we're given a module, see if we - // can find the appropriate module - // loaded in the binary, and fix up m_addr to use that. + // can find the appropriate module loaded in the binary, and fix up + // m_addr to use that. if (!m_addr.IsSectionOffset() && m_module_filespec) { Target &target = m_breakpoint->GetTarget(); ModuleSpec module_spec(m_module_filespec); Index: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -110,10 +110,10 @@ // Filter the symbol context list to remove contexts where the line number was // moved into a new function. We do this conservatively, so if e.g. we cannot -// resolve the function in the context (which can happen in case of -// line-table-only debug info), we leave the context as is. The trickiest part -// here is handling inlined functions -- in this case we need to make sure we -// look at the declaration line of the inlined function, NOT the function it was +// resolve the function in the context (which can happen in case of line-table- +// only debug info), we leave the context as is. The trickiest part here is +// handling inlined functions -- in this case we need to make sure we look at +// the declaration line of the inlined function, NOT the function it was // inlined into. void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, bool is_relative) { @@ -133,8 +133,8 @@ // relative parts of the path match the path from support files auto sc_dir = sc.line_entry.file.GetDirectory().GetStringRef(); if (!sc_dir.endswith(relative_path)) { - // We had a relative path specified and the relative directory - // doesn't match so remove this one + // We had a relative path specified and the relative directory doesn't + // match so remove this one LLDB_LOG(log, "removing not matching relative path {0} since it " "doesn't end with {1}", sc_dir, relative_path); sc_list.RemoveContextAtIndex(i); @@ -199,20 +199,20 @@ assert(m_breakpoint != NULL); // There is a tricky bit here. You can have two compilation units that - // #include the same file, and in one of them the function at m_line_number is - // used (and so code and a line entry for it is generated) but in the other it - // isn't. If we considered the CU's independently, then in the second - // inclusion, we'd move the breakpoint to the next function that actually - // generated code in the header file. That would end up being confusing. So - // instead, we do the CU iterations by hand here, then scan through the - // complete list of matches, and figure out the closest line number match, and - // only set breakpoints on that match. - - // Note also that if file_spec only had a file name and not a directory, there - // may be many different file spec's in the resultant list. The closest line - // match for one will not be right for some totally different file. So we go - // through the match list and pull out the sets that have the same file spec - // in their line_entry and treat each set separately. + // #include the same file, and in one of them the function at m_line_number + // is used (and so code and a line entry for it is generated) but in the + // other it isn't. If we considered the CU's independently, then in the + // second inclusion, we'd move the breakpoint to the next function that + // actually generated code in the header file. That would end up being + // confusing. So instead, we do the CU iterations by hand here, then scan + // through the complete list of matches, and figure out the closest line + // number match, and only set breakpoints on that match. + + // Note also that if file_spec only had a file name and not a directory, + // there may be many different file spec's in the resultant list. The + // closest line match for one will not be right for some totally different + // file. So we go through the match list and pull out the sets that have the + // same file spec in their line_entry and treat each set separately. FileSpec search_file_spec = m_file_spec; const bool is_relative = m_file_spec.IsRelative(); Index: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp +++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp @@ -241,9 +241,8 @@ // FIXME: Right now we look at the module level, and call the module's // "FindFunctions". // Greg says he will add function tables, maybe at the CompileUnit level to -// accelerate function -// lookup. At that point, we should switch the depth to CompileUnit, and look -// in these tables. +// accelerate function lookup. At that point, we should switch the depth to +// CompileUnit, and look in these tables. Searcher::CallbackReturn BreakpointResolverName::SearchCallback(SearchFilter &filter, @@ -301,8 +300,8 @@ break; } - // If the filter specifies a Compilation Unit, remove the ones that don't pass - // at this point. + // If the filter specifies a Compilation Unit, remove the ones that don't + // pass at this point. if (filter_by_cu || filter_by_language) { uint32_t num_functions = func_list.GetSize(); Index: lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp =================================================================== --- lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp +++ lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp @@ -24,8 +24,7 @@ BreakpointSiteList::~BreakpointSiteList() {} // Add breakpoint site to the list. However, if the element already exists in -// the -// list, then we don't add it, and return LLDB_INVALID_BREAK_ID. +// the list, then we don't add it, and return LLDB_INVALID_BREAK_ID. lldb::break_id_t BreakpointSiteList::Add(const BreakpointSiteSP &bp) { lldb::addr_t bp_site_load_addr = bp->GetLoadAddress(); @@ -45,8 +44,8 @@ BreakpointSiteSP site_sp(FindByID(site_id)); if (site_sp) { // Let the BreakpointSite decide if it should stop here (could not have - // reached it's target hit count yet, or it could have a callback - // that decided it shouldn't stop (shared library loads/unloads). + // reached it's target hit count yet, or it could have a callback that + // decided it shouldn't stop (shared library loads/unloads). return site_sp->ShouldStop(context); } // We should stop here since this BreakpointSite isn't valid anymore or it @@ -60,7 +59,8 @@ // PRIx64 " ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID()); return bp.get()->GetID(); } - // DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8" PRIx64 + // DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8" + // PRIx64 // " ) => NONE", __FUNCTION__, (uint64_t)addr); return LLDB_INVALID_BREAK_ID; } @@ -185,10 +185,9 @@ if (lower == m_bp_site_list.end() || (*lower).first >= upper_bound) return false; - // This is one tricky bit. The breakpoint might overlap the bottom end of the - // range. So we grab the - // breakpoint prior to the lower bound, and check that that + its byte size - // isn't in our range. + // This is one tricky bit. The breakpoint might overlap the bottom end of + // the range. So we grab the breakpoint prior to the lower bound, and check + // that that + its byte size isn't in our range. if (lower != m_bp_site_list.begin()) { collection::const_iterator prev_pos = lower; prev_pos--; Index: lldb/trunk/source/Breakpoint/Watchpoint.cpp =================================================================== --- lldb/trunk/source/Breakpoint/Watchpoint.cpp +++ lldb/trunk/source/Breakpoint/Watchpoint.cpp @@ -59,8 +59,8 @@ // This function is used when "baton" doesn't need to be freed void Watchpoint::SetCallback(WatchpointHitCallback callback, void *baton, bool is_synchronous) { - // The default "Baton" class will keep a copy of "baton" and won't free - // or delete it when it goes goes out of scope. + // The default "Baton" class will keep a copy of "baton" and won't free or + // delete it when it goes goes out of scope. m_options.SetCallback(callback, std::make_shared(baton), is_synchronous); @@ -103,8 +103,8 @@ Address watch_address(GetLoadAddress()); if (!m_type.IsValid()) { // Don't know how to report new & old values, since we couldn't make a - // scalar type for this watchpoint. - // This works around an assert in ValueObjectMemory::Create. + // scalar type for this watchpoint. This works around an assert in + // ValueObjectMemory::Create. // FIXME: This should not happen, but if it does in some case we care about, // we can go grab the value raw and print it as unsigned. return false; @@ -217,11 +217,9 @@ bool Watchpoint::IsEnabled() const { return m_enabled; } // Within StopInfo.cpp, we purposely turn on the ephemeral mode right before -// temporarily disable the watchpoint -// in order to perform possible watchpoint actions without triggering further -// watchpoint events. -// After the temporary disabled watchpoint is enabled, we then turn off the -// ephemeral mode. +// temporarily disable the watchpoint in order to perform possible watchpoint +// actions without triggering further watchpoint events. After the temporary +// disabled watchpoint is enabled, we then turn off the ephemeral mode. void Watchpoint::TurnOnEphemeralMode() { m_is_ephemeral = true; } Index: lldb/trunk/source/Breakpoint/WatchpointList.cpp =================================================================== --- lldb/trunk/source/Breakpoint/WatchpointList.cpp +++ lldb/trunk/source/Breakpoint/WatchpointList.cpp @@ -203,9 +203,9 @@ WatchpointSP wp_sp = FindByID(watch_id); if (wp_sp) { - // Let the Watchpoint decide if it should stop here (could not have - // reached it's target hit count yet, or it could have a callback - // that decided it shouldn't stop. + // Let the Watchpoint decide if it should stop here (could not have reached + // it's target hit count yet, or it could have a callback that decided it + // shouldn't stop. return wp_sp->ShouldStop(context); } // We should stop here since this Watchpoint isn't valid anymore or it Index: lldb/trunk/source/Breakpoint/WatchpointOptions.cpp =================================================================== --- lldb/trunk/source/Breakpoint/WatchpointOptions.cpp +++ lldb/trunk/source/Breakpoint/WatchpointOptions.cpp @@ -143,8 +143,7 @@ void WatchpointOptions::GetDescription(Stream *s, lldb::DescriptionLevel level) const { // Figure out if there are any options not at their default value, and only - // print - // anything if there are: + // print anything if there are: if ((GetThreadSpecNoCreate() != nullptr && GetThreadSpecNoCreate()->HasSpecification())) { Index: lldb/trunk/source/Commands/CommandCompletions.cpp =================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp +++ lldb/trunk/source/Commands/CommandCompletions.cpp @@ -149,8 +149,8 @@ return matches.GetSize(); } - // If there was no trailing slash, then we're done as soon as we resolve the - // expression to the correct directory. Otherwise we need to continue + // If there was no trailing slash, then we're done as soon as we resolve + // the expression to the correct directory. Otherwise we need to continue // looking for matches within that directory. if (FirstSep == llvm::StringRef::npos) { // Make sure it ends with a separator. Index: lldb/trunk/source/Commands/CommandObjectApropos.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectApropos.cpp +++ lldb/trunk/source/Commands/CommandObjectApropos.cpp @@ -53,8 +53,8 @@ if (argc == 1) { auto search_word = args[0].ref; if (!search_word.empty()) { - // The bulk of the work must be done inside the Command Interpreter, since - // the command dictionary is private. + // The bulk of the work must be done inside the Command Interpreter, + // since the command dictionary is private. StringList commands_found; StringList commands_help; Index: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp +++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp @@ -85,8 +85,8 @@ switch (short_option) { case 'c': - // Normally an empty breakpoint condition marks is as unset. - // But we need to say it was passed in. + // Normally an empty breakpoint condition marks is as unset. But we need + // to say it was passed in. m_bp_opts.SetCondition(option_arg.str().c_str()); m_bp_opts.m_set_flags.Set(BreakpointOptions::eCondition); break; @@ -263,8 +263,9 @@ "#included, set target.inline-breakpoint-strategy to \"always\"." }, { LLDB_OPT_SET_1, true, "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeLineNum, "Specifies the line number on which to set this breakpoint." }, - // Comment out this option for the moment, as we don't actually use it, but will in the future. - // This way users won't see it, but the infrastructure is left in place. + // Comment out this option for the moment, as we don't actually use it, but + // will in the future. This way users won't see it, but the infrastructure is + // left in place. // { 0, false, "column", 'C', OptionParser::eRequiredArgument, nullptr, "", // "Set the breakpoint by source location at this particular column."}, @@ -854,9 +855,9 @@ output_stream.Printf("Breakpoint set in dummy target, will get copied " "into future targets.\n"); else { - // Don't print out this warning for exception breakpoints. They can get - // set before the target is set, but we won't know how to actually set - // the breakpoint till we run. + // Don't print out this warning for exception breakpoints. They can + // get set before the target is set, but we won't know how to actually + // set the breakpoint till we run. if (bp_sp->GetNumLocations() == 0 && break_type != eSetTypeException) { output_stream.Printf("WARNING: Unable to resolve breakpoint to any " "actual locations.\n"); @@ -875,8 +876,8 @@ bool GetDefaultFile(Target *target, FileSpec &file, CommandReturnObject &result) { uint32_t default_line; - // First use the Source Manager's default file. - // Then use the current stack frame's file. + // First use the Source Manager's default file. Then use the current stack + // frame's file. if (!target->GetSourceManager().GetDefaultFileAndLine(file, default_line)) { StackFrame *cur_frame = m_exe_ctx.GetFramePtr(); if (cur_frame == nullptr) { @@ -1452,7 +1453,8 @@ return false; } - // The following are the various types of breakpoints that could be cleared: + // The following are the various types of breakpoints that could be + // cleared: // 1). -f -l (clearing breakpoint by source location) BreakpointClearType break_type = eClearTypeInvalid; @@ -1898,8 +1900,8 @@ return false; } } - // Now configure them, we already pre-checked the names so we don't need - // to check the error: + // Now configure them, we already pre-checked the names so we don't need to + // check the error: BreakpointSP bp_sp; if (m_bp_id.m_breakpoint.OptionWasSet()) { @@ -2560,11 +2562,10 @@ } // Create a new Args variable to use; copy any non-breakpoint-id-ranges stuff - // directly from the old ARGS to - // the new TEMP_ARGS. Do not copy breakpoint id range strings over; instead - // generate a list of strings for - // all the breakpoint ids in the range, and shove all of those breakpoint id - // strings into TEMP_ARGS. + // directly from the old ARGS to the new TEMP_ARGS. Do not copy breakpoint + // id range strings over; instead generate a list of strings for all the + // breakpoint ids in the range, and shove all of those breakpoint id strings + // into TEMP_ARGS. BreakpointIDList::FindAndReplaceIDRanges(args, target, allow_locations, purpose, result, temp_args); @@ -2575,15 +2576,13 @@ valid_ids->InsertStringArray(temp_args.GetConstArgumentVector(), temp_args.GetArgumentCount(), result); - // At this point, all of the breakpoint ids that the user passed in have been - // converted to breakpoint IDs - // and put into valid_ids. + // At this point, all of the breakpoint ids that the user passed in have + // been converted to breakpoint IDs and put into valid_ids. if (result.Succeeded()) { // Now that we've converted everything from args into a list of breakpoint - // ids, go through our tentative list - // of breakpoint id's and verify that they correspond to valid/currently set - // breakpoints. + // ids, go through our tentative list of breakpoint id's and verify that + // they correspond to valid/currently set breakpoints. const size_t count = valid_ids->GetSize(); for (size_t i = 0; i < count; ++i) { Index: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp +++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp @@ -412,8 +412,8 @@ } else { BreakpointLocationSP bp_loc_sp( bp->FindLocationByID(cur_bp_id.GetLocationID())); - // This breakpoint does have an associated location. - // Get its breakpoint options. + // This breakpoint does have an associated location. Get its + // breakpoint options. if (bp_loc_sp) bp_options = bp_loc_sp->GetLocationOptions(); } @@ -422,9 +422,9 @@ } } - // If we are using script language, get the script interpreter - // in order to set or collect command callback. Otherwise, call - // the methods associated with this object. + // If we are using script language, get the script interpreter in order + // to set or collect command callback. Otherwise, call the methods + // associated with this object. if (m_options.m_use_script_language) { ScriptInterpreter *script_interp = m_interpreter.GetScriptInterpreter(); // Special handling for one-liner specified inline. @@ -456,16 +456,15 @@ std::vector m_bp_options_vec; // This stores the // breakpoint options that // we are currently - // collecting commands for. In the CollectData... calls we need - // to hand this off to the IOHandler, which may run asynchronously. - // So we have to have some way to keep it alive, and not leak it. - // Making it an ivar of the command object, which never goes away - // achieves this. Note that if we were able to run - // the same command concurrently in one interpreter we'd have to - // make this "per invocation". But there are many more reasons - // why it is not in general safe to do that in lldb at present, - // so it isn't worthwhile to come up with a more complex mechanism - // to address this particular weakness right now. + // collecting commands for. In the CollectData... calls we need to hand this + // off to the IOHandler, which may run asynchronously. So we have to have + // some way to keep it alive, and not leak it. Making it an ivar of the + // command object, which never goes away achieves this. Note that if we were + // able to run the same command concurrently in one interpreter we'd have to + // make this "per invocation". But there are many more reasons why it is not + // in general safe to do that in lldb at present, so it isn't worthwhile to + // come up with a more complex mechanism to address this particular weakness + // right now. static const char *g_reader_instructions; }; Index: lldb/trunk/source/Commands/CommandObjectCommands.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectCommands.cpp +++ lldb/trunk/source/Commands/CommandObjectCommands.cpp @@ -331,9 +331,8 @@ m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options, result); } else { - // No options were set, inherit any settings from nested "command - // source" commands, - // or set to sane default settings... + // No options were set, inherit any settings from nested "command source" + // commands, or set to sane default settings... CommandInterpreterRunOptions options; m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options, result); } @@ -614,8 +613,7 @@ } // Strip the new alias name off 'raw_command_string' (leave it on args, - // which gets passed to 'Execute', which - // does the stripping itself. + // which gets passed to 'Execute', which does the stripping itself. size_t pos = raw_command_string.find(alias_command); if (pos == 0) { raw_command_string = raw_command_string.substr(alias_command.size()); @@ -653,9 +651,8 @@ return false; } else if (!cmd_obj->WantsRawCommandString()) { // Note that args was initialized with the original command, and has not - // been updated to this point. - // Therefore can we pass it to the version of Execute that does not - // need/expect raw input in the alias. + // been updated to this point. Therefore can we pass it to the version of + // Execute that does not need/expect raw input in the alias. return HandleAliasingNormalCommand(args, result); } else { return HandleAliasingRawCommand(alias_command, raw_command_string, @@ -1129,8 +1126,8 @@ return error; } const size_t first_separator_char_pos = 1; - // use the char that follows 's' as the regex separator character - // so we can have "s///" or "s|||" + // use the char that follows 's' as the regex separator character so we can + // have "s///" or "s|||" const char separator_char = regex_sed[first_separator_char_pos]; const size_t second_separator_char_pos = regex_sed.find(separator_char, first_separator_char_pos + 1); @@ -1159,8 +1156,7 @@ } if (third_separator_char_pos != regex_sed_size - 1) { - // Make sure that everything that follows the last regex - // separator char + // Make sure that everything that follows the last regex separator char if (regex_sed.find_first_not_of("\t\n\v\f\r ", third_separator_char_pos + 1) != std::string::npos) { @@ -1541,10 +1537,11 @@ // FIXME: this is necessary because CommandObject::CheckRequirements() // assumes that commands won't ever be recursively invoked, but it's // actually possible to craft a Python script that does other "command - // script imports" in __lldb_init_module the real fix is to have recursive - // commands possible with a CommandInvocation object separate from the - // CommandObject itself, so that recursive command invocations won't stomp - // on each other (wrt to execution contents, options, and more) + // script imports" in __lldb_init_module the real fix is to have + // recursive commands possible with a CommandInvocation object separate + // from the CommandObject itself, so that recursive command invocations + // won't stomp on each other (wrt to execution contents, options, and + // more) m_exe_ctx.Clear(); if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule( entry.c_str(), m_options.m_allow_reload, init_session, error)) { Index: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp +++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp @@ -126,8 +126,8 @@ case 'l': frame_line = true; - // Disassemble the current source line kind of implies showing mixed - // source code context. + // Disassemble the current source line kind of implies showing mixed source + // code context. show_mixed = true; some_location_specified = true; break; @@ -205,10 +205,9 @@ execution_context ? execution_context->GetTargetPtr() : nullptr; // This is a hack till we get the ability to specify features based on - // architecture. For now GetDisassemblyFlavor - // is really only valid for x86 (and for the llvm assembler plugin, but I'm - // papering over that since that is the - // only disassembler plugin we have... + // architecture. For now GetDisassemblyFlavor is really only valid for x86 + // (and for the llvm assembler plugin, but I'm papering over that since that + // is the only disassembler plugin we have... if (target) { if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86 || target->GetArchitecture().GetTriple().getArch() == @@ -375,8 +374,8 @@ } } - // Did the "m_options.frame_line" find a valid range already? If so - // skip the rest... + // Did the "m_options.frame_line" find a valid range already? If so skip + // the rest... if (range.GetByteSize() == 0) { if (m_options.at_pc) { if (frame == nullptr) { Index: lldb/trunk/source/Commands/CommandObjectExpression.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectExpression.cpp +++ lldb/trunk/source/Commands/CommandObjectExpression.cpp @@ -322,9 +322,9 @@ Stream *output_stream, Stream *error_stream, CommandReturnObject *result) { - // Don't use m_exe_ctx as this might be called asynchronously - // after the command object DoExecute has finished when doing - // multi-line expression that use an input reader... + // Don't use m_exe_ctx as this might be called asynchronously after the + // command object DoExecute has finished when doing multi-line expression + // that use an input reader... ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); Target *target = exe_ctx.GetTargetPtr(); @@ -363,8 +363,8 @@ if (m_command_options.top_level) options.SetExecutionPolicy(eExecutionPolicyTopLevel); - // If there is any chance we are going to stop and want to see - // what went wrong with our expression, we should generate debug info + // If there is any chance we are going to stop and want to see what went + // wrong with our expression, we should generate debug info if (!m_command_options.ignore_breakpoints || !m_command_options.unwind_on_error) options.SetGenerateDebugInfo(true); @@ -475,9 +475,8 @@ // An empty lines is used to indicate the end of input const size_t num_lines = lines.GetSize(); if (num_lines > 0 && lines[num_lines - 1].empty()) { - // Remove the last empty line from "lines" so it doesn't appear - // in our resulting input and return true to indicate we are done - // getting lines + // Remove the last empty line from "lines" so it doesn't appear in our + // resulting input and return true to indicate we are done getting lines lines.PopBack(); return true; } @@ -562,19 +561,16 @@ Debugger &debugger = target->GetDebugger(); // Check if the LLDB command interpreter is sitting on top of a REPL - // that - // launched it... + // that launched it... if (debugger.CheckTopIOHandlerTypes( IOHandler::Type::CommandInterpreter, IOHandler::Type::REPL)) { // the LLDB command interpreter is sitting on top of a REPL that - // launched it, - // so just say the command interpreter is done and fall back to the - // existing REPL + // launched it, so just say the command interpreter is done and + // fall back to the existing REPL m_interpreter.GetIOHandler(false)->SetIsDone(true); } else { // We are launching the REPL on top of the current LLDB command - // interpreter, - // so just push one + // interpreter, so just push one bool initialize = false; Status repl_error; REPLSP repl_sp(target->GetREPL( @@ -642,14 +638,12 @@ } history.AppendString(fixed_command); } - // Increment statistics to record this expression evaluation - // success. + // Increment statistics to record this expression evaluation success. target->IncrementStats(StatisticKind::ExpressionSuccessful); return true; } - // Increment statistics to record this expression evaluation - // failure. + // Increment statistics to record this expression evaluation failure. target->IncrementStats(StatisticKind::ExpressionFailure); result.SetStatus(eReturnStatusFailed); return false; Index: lldb/trunk/source/Commands/CommandObjectFrame.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectFrame.cpp +++ lldb/trunk/source/Commands/CommandObjectFrame.cpp @@ -342,8 +342,8 @@ frame_idx += m_options.relative_frame_offset; else { if (frame_idx == 0) { - // If you are already at the bottom of the stack, then just warn and - // don't reset the frame. + // If you are already at the bottom of the stack, then just warn + // and don't reset the frame. result.AppendError("Already at the bottom of the stack."); result.SetStatus(eReturnStatusFailed); return false; @@ -504,16 +504,15 @@ } bool DoExecute(Args &command, CommandReturnObject &result) override { - // No need to check "frame" for validity as eCommandRequiresFrame ensures it - // is valid + // No need to check "frame" for validity as eCommandRequiresFrame ensures + // it is valid StackFrame *frame = m_exe_ctx.GetFramePtr(); Stream &s = result.GetOutputStream(); // Be careful about the stack frame, if any summary formatter runs code, it - // might clear the StackFrameList - // for the thread. So hold onto a shared pointer to the frame so it stays - // alive. + // might clear the StackFrameList for the thread. So hold onto a shared + // pointer to the frame so it stays alive. VariableList *variable_list = frame->GetVariableList(m_option_variable.show_globals); @@ -547,8 +546,8 @@ if (!command.empty()) { VariableList regex_var_list; - // If we have any args to the variable command, we will make - // variable objects from them... + // If we have any args to the variable command, we will make variable + // objects from them... for (auto &entry : command) { if (m_option_variable.use_regex) { const size_t regex_start_index = regex_var_list.GetSize(); @@ -677,14 +676,13 @@ if (m_option_variable.show_scope) scope_string = GetScopeString(var_sp).str(); - // Use the variable object code to make sure we are - // using the same APIs as the public API will be - // using... + // Use the variable object code to make sure we are using the same + // APIs as the public API will be using... valobj_sp = frame->GetValueObjectForFrameVariable( var_sp, m_varobj_options.use_dynamic); if (valobj_sp) { - // When dumping all variables, don't print any variables - // that are not in scope to avoid extra unneeded output + // When dumping all variables, don't print any variables that are + // not in scope to avoid extra unneeded output if (valobj_sp->IsInScope()) { if (!valobj_sp->GetTargetSP() ->GetDisplayRuntimeSupportValues() && Index: lldb/trunk/source/Commands/CommandObjectHelp.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectHelp.cpp +++ lldb/trunk/source/Commands/CommandObjectHelp.cpp @@ -89,10 +89,9 @@ CommandObject *cmd_obj; const size_t argc = command.GetArgumentCount(); - // 'help' doesn't take any arguments, other than command names. If argc is 0, - // we show the user - // all commands (aliases and user commands if asked for). Otherwise every - // argument must be the name of a command or a sub-command. + // 'help' doesn't take any arguments, other than command names. If argc is + // 0, we show the user all commands (aliases and user commands if asked for). + // Otherwise every argument must be the name of a command or a sub-command. if (argc == 0) { uint32_t cmd_types = CommandInterpreter::eCommandTypesBuiltin; if (m_options.m_show_aliases) @@ -225,8 +224,8 @@ CommandObject *cmd_obj = m_interpreter.GetCommandObject(input[0].ref); // The command that they are getting help on might be ambiguous, in which - // case we should complete that, - // otherwise complete with the command the user is getting help on... + // case we should complete that, otherwise complete with the command the + // user is getting help on... if (cmd_obj) { input.Shift(); Index: lldb/trunk/source/Commands/CommandObjectMemory.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp @@ -554,8 +554,8 @@ lldb::addr_t addr; size_t total_byte_size = 0; if (argc == 0) { - // Use the last address and byte size and all options as they were - // if no options have been set + // Use the last address and byte size and all options as they were if no + // options have been set addr = m_next_addr; total_byte_size = m_prev_byte_size; clang_ast_type = m_prev_clang_ast_type; @@ -574,8 +574,8 @@ // TODO For non-8-bit byte addressable architectures this needs to be // revisited to fully support all lldb's range of formatting options. - // Furthermore code memory reads (for those architectures) will not - // be correctly formatted even w/o formatting options. + // Furthermore code memory reads (for those architectures) will not be + // correctly formatted even w/o formatting options. size_t item_byte_size = target->GetArchitecture().GetDataByteSize() > 1 ? target->GetArchitecture().GetDataByteSize() @@ -844,16 +844,14 @@ if (!m_format_options.GetCountValue().OptionWasSet() || item_count == 1) { // this turns requests such as // memory read -fc -s10 -c1 *charPtrPtr - // which make no sense (what is a char of size 10?) - // into a request for fetching 10 chars of size 1 from the same memory - // location + // which make no sense (what is a char of size 10?) into a request for + // fetching 10 chars of size 1 from the same memory location format = eFormatCharArray; item_count = item_byte_size; item_byte_size = 1; } else { - // here we passed a count, and it was not 1 - // so we have a byte_size and a count - // we could well multiply those, but instead let's just fail + // here we passed a count, and it was not 1 so we have a byte_size and + // a count we could well multiply those, but instead let's just fail result.AppendErrorWithFormat( "reading memory as characters of size %" PRIu64 " is not supported", (uint64_t)item_byte_size); Index: lldb/trunk/source/Commands/CommandObjectMultiword.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp @@ -55,8 +55,7 @@ if (num_matches == 1) { // Cleaner, but slightly less efficient would be to call back into this - // function, since I now - // know I have an exact match... + // function, since I now know I have an exact match... sub_cmd = matches->GetStringAtIndex(0); pos = m_subcommand_dict.find(sub_cmd); @@ -121,8 +120,8 @@ CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches); if (sub_cmd_obj != nullptr) { // Now call CommandObject::Execute to process options in `rest_of_line`. - // From there the command-specific version of Execute will be called, - // with the processed arguments. + // From there the command-specific version of Execute will be called, with + // the processed arguments. args.Shift(); sub_cmd_obj->Execute(args_string, result); @@ -156,8 +155,8 @@ } void CommandObjectMultiword::GenerateHelpText(Stream &output_stream) { - // First time through here, generate the help text for the object and - // push it to the return result object as well + // First time through here, generate the help text for the object and push it + // to the return result object as well CommandObject::GenerateHelpText(output_stream); output_stream.PutCString("\nThe following subcommands are supported:\n\n"); Index: lldb/trunk/source/Commands/CommandObjectPlatform.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectPlatform.cpp +++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp @@ -385,8 +385,8 @@ Status error; if (platform_sp->IsConnected()) { - // Cache the instance name if there is one since we are - // about to disconnect and the name might go with it. + // Cache the instance name if there is one since we are about to + // disconnect and the name might go with it. const char *hostname_cstr = platform_sp->GetHostname(); std::string hostname; if (hostname_cstr) @@ -867,8 +867,8 @@ // argument entry. arg2.push_back(file_arg_host); - // Push the data for the first and the second arguments into the m_arguments - // vector. + // Push the data for the first and the second arguments into the + // m_arguments vector. m_arguments.push_back(arg1); m_arguments.push_back(arg2); } @@ -1059,8 +1059,8 @@ if (argc > 0) { if (m_options.launch_info.GetExecutableFile()) { - // We already have an executable file, so we will use this - // and all arguments to this function are extra arguments + // We already have an executable file, so we will use this and all + // arguments to this function are extra arguments m_options.launch_info.GetArguments().AppendArguments(args); } else { // We don't have any file yet, so the first argument is our @@ -1574,8 +1574,7 @@ // Are we in the name? // Look to see if there is a -P argument provided, and if so use that - // plugin, otherwise - // use the default plugin. + // plugin, otherwise use the default plugin. const char *partial_name = nullptr; partial_name = input.GetArgumentAtIndex(opt_arg_pos); Index: lldb/trunk/source/Commands/CommandObjectProcess.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectProcess.cpp +++ lldb/trunk/source/Commands/CommandObjectProcess.cpp @@ -180,18 +180,18 @@ llvm::StringRef target_settings_argv0 = target->GetArg0(); // Determine whether we will disable ASLR or leave it in the default state - // (i.e. enabled if the platform supports it). - // First check if the process launch options explicitly turn on/off + // (i.e. enabled if the platform supports it). First check if the process + // launch options explicitly turn on/off // disabling ASLR. If so, use that setting; // otherwise, use the 'settings target.disable-aslr' setting. bool disable_aslr = false; if (m_options.disable_aslr != eLazyBoolCalculate) { - // The user specified an explicit setting on the process launch line. Use - // it. + // The user specified an explicit setting on the process launch line. + // Use it. disable_aslr = (m_options.disable_aslr == eLazyBoolYes); } else { - // The user did not explicitly specify whether to disable ASLR. Fall back - // to the target.disable-aslr setting. + // The user did not explicitly specify whether to disable ASLR. Fall + // back to the target.disable-aslr setting. disable_aslr = target->GetDisableASLR(); } @@ -234,10 +234,9 @@ ProcessSP process_sp(target->GetProcessSP()); if (process_sp) { // There is a race condition where this thread will return up the call - // stack to the main command - // handler and show an (lldb) prompt before HandlePrivateEvent (from - // PrivateStateThread) has - // a chance to call PushProcessIOHandler(). + // stack to the main command handler and show an (lldb) prompt before + // HandlePrivateEvent (from PrivateStateThread) has a chance to call + // PushProcessIOHandler(). process_sp->SyncIOHandler(0, 2000); llvm::StringRef data = stream.GetString(); @@ -401,8 +400,7 @@ // Are we in the name? // Look to see if there is a -P argument provided, and if so use that - // plugin, otherwise - // use the default plugin. + // plugin, otherwise use the default plugin. const char *partial_name = nullptr; partial_name = input.GetArgumentAtIndex(opt_arg_pos); @@ -453,10 +451,9 @@ Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); // N.B. The attach should be synchronous. It doesn't help much to get the - // prompt back between initiating the attach - // and the target actually stopping. So even if the interpreter is set to - // be asynchronous, we wait for the stop - // ourselves here. + // prompt back between initiating the attach and the target actually + // stopping. So even if the interpreter is set to be asynchronous, we wait + // for the stop ourselves here. StateType state = eStateInvalid; Process *process = m_exe_ctx.GetProcessPtr(); @@ -482,9 +479,8 @@ } // Record the old executable module, we want to issue a warning if the - // process of attaching changed the - // current executable (like somebody said "file foo" then attached to a PID - // whose executable was bar.) + // process of attaching changed the current executable (like somebody said + // "file foo" then attached to a PID whose executable was bar.) ModuleSP old_exec_module_sp = target->GetExecutableModule(); ArchSpec old_arch_spec = target->GetArchitecture(); @@ -553,8 +549,8 @@ target->GetArchitecture().GetTriple().getTriple().c_str()); } - // This supports the use-case scenario of immediately continuing the process - // once attached. + // This supports the use-case scenario of immediately continuing the + // process once attached. if (m_options.attach_info.GetContinueOnceAttached()) m_interpreter.HandleCommand("process continue", eLazyBoolNo, result); @@ -692,10 +688,9 @@ if (error.Success()) { // There is a race condition where this thread will return up the call - // stack to the main command - // handler and show an (lldb) prompt before HandlePrivateEvent (from - // PrivateStateThread) has - // a chance to call PushProcessIOHandler(). + // stack to the main command handler and show an (lldb) prompt before + // HandlePrivateEvent (from PrivateStateThread) has a chance to call + // PushProcessIOHandler(). process->SyncIOHandler(iohandler_id, 2000); result.AppendMessageWithFormat("Process %" PRIu64 " resuming\n", @@ -1560,8 +1555,7 @@ int32_t signo = signals_sp->GetSignalNumberFromName(arg.c_str()); if (signo != LLDB_INVALID_SIGNAL_NUMBER) { // Casting the actions as bools here should be okay, because - // VerifyCommandOptionValue guarantees - // the value is either 0 or 1. + // VerifyCommandOptionValue guarantees the value is either 0 or 1. if (stop_action != -1) signals_sp->SetShouldStop(signo, stop_action); if (pass_action != -1) { Index: lldb/trunk/source/Commands/CommandObjectQuit.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectQuit.cpp +++ lldb/trunk/source/Commands/CommandObjectQuit.cpp @@ -30,10 +30,9 @@ CommandObjectQuit::~CommandObjectQuit() {} -// returns true if there is at least one alive process -// is_a_detach will be true if all alive processes will be detached when you -// quit -// and false if at least one process will be killed instead +// returns true if there is at least one alive process is_a_detach will be true +// if all alive processes will be detached when you quit and false if at least +// one process will be killed instead bool CommandObjectQuit::ShouldAskForConfirmation(bool &is_a_detach) { if (m_interpreter.GetPromptOnQuit() == false) return false; Index: lldb/trunk/source/Commands/CommandObjectRegister.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectRegister.cpp +++ lldb/trunk/source/Commands/CommandObjectRegister.cpp @@ -192,8 +192,8 @@ num_register_sets = reg_ctx->GetRegisterSetCount(); for (set_idx = 0; set_idx < num_register_sets; ++set_idx) { - // When dump_all_sets option is set, dump primitive as well as derived - // registers. + // When dump_all_sets option is set, dump primitive as well as + // derived registers. DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx, !m_command_options.dump_all_sets.GetCurrentValue()); } @@ -209,8 +209,8 @@ result.SetStatus(eReturnStatusFailed); } else { for (auto &entry : command) { - // in most LLDB commands we accept $rbx as the name for register RBX - - // and here we would reject it and non-existant. we should be more + // in most LLDB commands we accept $rbx as the name for register RBX + // - and here we would reject it and non-existant. we should be more // consistent towards the user and allow them to say reg read $rbx - // internally, however, we should be strict and not allow ourselves // to call our registers $rbx in our own API @@ -350,11 +350,11 @@ auto reg_name = command[0].ref; auto value_str = command[1].ref; - // in most LLDB commands we accept $rbx as the name for register RBX - and - // here we would reject it and non-existant. we should be more consistent - // towards the user and allow them to say reg write $rbx - internally, - // however, we should be strict and not allow ourselves to call our - // registers $rbx in our own API + // in most LLDB commands we accept $rbx as the name for register RBX - + // and here we would reject it and non-existant. we should be more + // consistent towards the user and allow them to say reg write $rbx - + // internally, however, we should be strict and not allow ourselves to + // call our registers $rbx in our own API reg_name.consume_front("$"); const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name); @@ -365,8 +365,8 @@ Status error(reg_value.SetValueFromString(reg_info, value_str)); if (error.Success()) { if (reg_ctx->WriteRegister(reg_info, reg_value)) { - // Toss all frames and anything else in the thread - // after a register has been written. + // Toss all frames and anything else in the thread after a register + // has been written. m_exe_ctx.GetThreadRef().Flush(); result.SetStatus(eReturnStatusSuccessFinishNoResult); return true; Index: lldb/trunk/source/Commands/CommandObjectSettings.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectSettings.cpp +++ lldb/trunk/source/Commands/CommandObjectSettings.cpp @@ -220,10 +220,8 @@ if (error.Success()) { // FIXME this is the same issue as the one in commands script import // we could be setting target.load-script-from-symbol-file which would - // cause - // Python scripts to be loaded, which could run LLDB commands - // (e.g. settings set target.process.python-os-plugin-path) and cause a - // crash + // cause Python scripts to be loaded, which could run LLDB commands (e.g. + // settings set target.process.python-os-plugin-path) and cause a crash // if we did not clear the command's exe_ctx first ExecutionContext exe_ctx(m_exe_ctx); m_exe_ctx.Clear(); @@ -920,8 +918,8 @@ return false; } - // Do not perform cmd_args.Shift() since StringRef is manipulating the - // raw character string later on. + // Do not perform cmd_args.Shift() since StringRef is manipulating the raw + // character string later on. // Split the raw command into var_name and value pair. llvm::StringRef raw_str(command); Index: lldb/trunk/source/Commands/CommandObjectSource.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectSource.cpp +++ lldb/trunk/source/Commands/CommandObjectSource.cpp @@ -148,16 +148,13 @@ Options *GetOptions() override { return &m_options; } protected: - // Dump the line entries in each symbol context. - // Return the number of entries found. - // If module_list is set, only dump lines contained in one of the modules. - // If file_spec is set, only dump lines in the file. - // If the start_line option was specified, don't print lines less than - // start_line. + // Dump the line entries in each symbol context. Return the number of entries + // found. If module_list is set, only dump lines contained in one of the + // modules. If file_spec is set, only dump lines in the file. If the + // start_line option was specified, don't print lines less than start_line. // If the end_line option was specified, don't print lines greater than - // end_line. - // If the num_lines option was specified, dont print more than num_lines - // entries. + // end_line. If the num_lines option was specified, dont print more than + // num_lines entries. uint32_t DumpLinesInSymbolContexts(Stream &strm, const SymbolContextList &sc_list, const ModuleList &module_list, @@ -222,14 +219,11 @@ } // Dump the requested line entries for the file in the compilation unit. - // Return the number of entries found. - // If module_list is set, only dump lines contained in one of the modules. - // If the start_line option was specified, don't print lines less than - // start_line. - // If the end_line option was specified, don't print lines greater than - // end_line. - // If the num_lines option was specified, dont print more than num_lines - // entries. + // Return the number of entries found. If module_list is set, only dump lines + // contained in one of the modules. If the start_line option was specified, + // don't print lines less than start_line. If the end_line option was + // specified, don't print lines greater than end_line. If the num_lines + // option was specified, dont print more than num_lines entries. uint32_t DumpFileLinesInCompUnit(Stream &strm, Module *module, CompileUnit *cu, const FileSpec &file_spec) { uint32_t start_line = m_options.start_line; @@ -259,8 +253,8 @@ while (true) { LineEntry line_entry; - // Find the lowest index of a line entry with a line equal to - // or higher than 'line'. + // Find the lowest index of a line entry with a line equal to or + // higher than 'line'. uint32_t start_idx = 0; start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec, /*exact=*/false, &line_entry); @@ -271,7 +265,8 @@ if (end_line > 0 && line_entry.line > end_line) break; - // Loop through to find any other entries for this line, dumping each. + // Loop through to find any other entries for this line, dumping + // each. line = line_entry.line; do { num_matches++; @@ -305,22 +300,18 @@ return num_matches; } - // Dump the requested line entries for the file in the module. - // Return the number of entries found. - // If module_list is set, only dump lines contained in one of the modules. - // If the start_line option was specified, don't print lines less than - // start_line. - // If the end_line option was specified, don't print lines greater than - // end_line. - // If the num_lines option was specified, dont print more than num_lines - // entries. + // Dump the requested line entries for the file in the module. Return the + // number of entries found. If module_list is set, only dump lines contained + // in one of the modules. If the start_line option was specified, don't print + // lines less than start_line. If the end_line option was specified, don't + // print lines greater than end_line. If the num_lines option was specified, + // dont print more than num_lines entries. uint32_t DumpFileLinesInModule(Stream &strm, Module *module, const FileSpec &file_spec) { uint32_t num_matches = 0; if (module) { // Look through all the compilation units (CUs) in this module for ones - // that - // contain lines of code from this source file. + // that contain lines of code from this source file. for (size_t i = 0; i < module->GetNumCompileUnits(); i++) { // Look for a matching source file in this CU. CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i)); @@ -334,10 +325,8 @@ } // Given an address and a list of modules, append the symbol contexts of all - // line entries - // containing the address found in the modules and return the count of - // matches. If none - // is found, return an error in 'error_strm'. + // line entries containing the address found in the modules and return the + // count of matches. If none is found, return an error in 'error_strm'. size_t GetSymbolContextsForAddress(const ModuleList &module_list, lldb::addr_t addr, SymbolContextList &sc_list, @@ -347,8 +336,8 @@ assert(module_list.GetSize() > 0); Target *target = m_exe_ctx.GetTargetPtr(); if (target->GetSectionLoadList().IsEmpty()) { - // The target isn't loaded yet, we need to lookup the file address in - // all modules. Note: the module list option does not apply to addresses. + // The target isn't loaded yet, we need to lookup the file address in all + // modules. Note: the module list option does not apply to addresses. const size_t num_modules = module_list.GetSize(); for (size_t i = 0; i < num_modules; ++i) { ModuleSP module_sp(module_list.GetModuleAtIndex(i)); @@ -370,8 +359,8 @@ " not found in any modules.\n", addr); } else { - // The target has some things loaded, resolve this address to a - // compile unit + file + line and display + // The target has some things loaded, resolve this address to a compile + // unit + file + line and display if (target->GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) { ModuleSP module_sp(so_addr.GetModule()); // Check to make sure this module is in our list. @@ -409,8 +398,8 @@ return num_matches; } - // Dump the line entries found in functions matching the name specified in the - // option. + // Dump the line entries found in functions matching the name specified in + // the option. bool DumpLinesInFunctions(CommandReturnObject &result) { SymbolContextList sc_list_funcs; ConstString name(m_options.symbol_name.c_str()); @@ -774,9 +763,9 @@ const char *GetRepeatCommand(Args ¤t_command_args, uint32_t index) override { - // This is kind of gross, but the command hasn't been parsed yet so we can't - // look at the option values for this invocation... I have to scan the - // arguments directly. + // This is kind of gross, but the command hasn't been parsed yet so we + // can't look at the option values for this invocation... I have to scan + // the arguments directly. auto iter = llvm::find_if(current_command_args, [](const Args::ArgEntry &e) { return e.ref == "-r" || e.ref == "--reverse"; @@ -864,11 +853,9 @@ } // This is a little hacky, but the first line table entry for a function - // points to the "{" that - // starts the function block. It would be nice to actually get the - // function - // declaration in there too. So back up a bit, but not further than what - // you're going to display. + // points to the "{" that starts the function block. It would be nice to + // actually get the function declaration in there too. So back up a bit, + // but not further than what you're going to display. uint32_t extra_lines; if (m_options.num_lines >= 10) extra_lines = 5; @@ -881,8 +868,7 @@ line_no = start_line - extra_lines; // For fun, if the function is shorter than the number of lines we're - // supposed to display, - // only display the function... + // supposed to display, only display the function... if (end_line != 0) { if (m_options.num_lines > end_line - line_no) m_options.num_lines = end_line - line_no + extra_lines; @@ -913,14 +899,13 @@ return 0; } - // From Jim: The FindMatchingFunctions / FindMatchingFunctionSymbols functions - // "take a possibly empty vector of strings which are names of modules, and - // run the two search functions on the subset of the full module list that - // matches the strings in the input vector". If we wanted to put these - // somewhere, - // there should probably be a module-filter-list that can be passed to the - // various ModuleList::Find* calls, which would either be a vector of string - // names or a ModuleSpecList. + // From Jim: The FindMatchingFunctions / FindMatchingFunctionSymbols + // functions "take a possibly empty vector of strings which are names of + // modules, and run the two search functions on the subset of the full module + // list that matches the strings in the input vector". If we wanted to put + // these somewhere, there should probably be a module-filter-list that can be + // passed to the various ModuleList::Find* calls, which would either be a + // vector of string names or a ModuleSpecList. size_t FindMatchingFunctions(Target *target, const ConstString &name, SymbolContextList &sc_list) { // Displaying the source for a symbol: @@ -997,8 +982,7 @@ size_t num_matches = FindMatchingFunctions(target, name, sc_list); if (!num_matches) { // If we didn't find any functions with that name, try searching for - // symbols - // that line up exactly with function addresses. + // symbols that line up exactly with function addresses. SymbolContextList sc_list_symbols; size_t num_symbol_matches = FindMatchingFunctionSymbols(target, name, sc_list_symbols); @@ -1065,8 +1049,8 @@ SymbolContextList sc_list; if (target->GetSectionLoadList().IsEmpty()) { - // The target isn't loaded yet, we need to lookup the file address - // in all modules + // The target isn't loaded yet, we need to lookup the file address in + // all modules const ModuleList &module_list = target->GetImages(); const size_t num_modules = module_list.GetSize(); for (size_t i = 0; i < num_modules; ++i) { @@ -1091,8 +1075,8 @@ return false; } } else { - // The target has some things loaded, resolve this address to a - // compile unit + file + line and display + // The target has some things loaded, resolve this address to a compile + // unit + file + line and display if (target->GetSectionLoadList().ResolveLoadAddress(m_options.address, so_addr)) { ModuleSP module_sp(so_addr.GetModule()); @@ -1169,11 +1153,10 @@ } } } else if (m_options.file_name.empty()) { - // Last valid source manager context, or the current frame if no - // valid last context in source manager. - // One little trick here, if you type the exact same list command twice in - // a row, it is - // more likely because you typed it once, then typed it again + // Last valid source manager context, or the current frame if no valid + // last context in source manager. One little trick here, if you type the + // exact same list command twice in a row, it is more likely because you + // typed it once, then typed it again if (m_options.start_line == 0) { if (target->GetSourceManager().DisplayMoreWithLineNumbers( &result.GetOutputStream(), m_options.num_lines, Index: lldb/trunk/source/Commands/CommandObjectTarget.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp @@ -274,10 +274,8 @@ if (target_sp) { // Only get the platform after we create the target because we might - // have - // switched platforms depending on what the arguments were to - // CreateTarget() - // we can't rely on the selected platform. + // have switched platforms depending on what the arguments were to + // CreateTarget() we can't rely on the selected platform. PlatformSP platform_sp = target_sp->GetPlatform(); @@ -368,8 +366,8 @@ &core_file)); if (process_sp) { - // Seems weird that we Launch a core file, but that is - // what we do! + // Seems weird that we Launch a core file, but that is what we + // do! error = process_sp->LoadCore(); if (error.Fail()) { @@ -618,8 +616,8 @@ target_list.DeleteTarget(target_sp); target_sp->Destroy(); } - // If "--clean" was specified, prune any orphaned shared modules from - // the global shared module list + // If "--clean" was specified, prune any orphaned shared modules from the + // global shared module list if (m_cleanup_option.GetOptionValue()) { const bool mandatory = true; ModuleList::RemoveOrphanSharedModules(mandatory); @@ -997,10 +995,9 @@ 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 + // 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... @@ -1111,10 +1108,9 @@ 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 + // 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... @@ -1635,8 +1631,8 @@ strm.PutCString(":\n"); for (TypeSP type_sp : type_list.Types()) { if (type_sp) { - // Resolve the clang type so that any forward references - // to types that haven't yet been parsed will get parsed. + // Resolve the clang type so that any forward references to types + // that haven't yet been parsed will get parsed. type_sp->GetFullCompilerType(); type_sp->GetDescription(&strm, eDescriptionLevelFull, true); // Print all typedef chains @@ -1686,8 +1682,8 @@ TypeSP type_sp(type_list.GetTypeAtIndex(0)); if (type_sp) { - // Resolve the clang type so that any forward references - // to types that haven't yet been parsed will get parsed. + // Resolve the clang type so that any forward references to types that + // haven't yet been parsed will get parsed. type_sp->GetFullCompilerType(); type_sp->GetDescription(&strm, eDescriptionLevelFull, true); // Print all typedef chains @@ -1765,9 +1761,8 @@ 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 + // 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 if (num_matches == 0) { module_spec.GetArchitecture() = target->GetArchitecture(); ModuleList::FindSharedModules(module_spec, module_list); @@ -2607,8 +2602,7 @@ ModuleSpec module_spec; bool search_using_module_spec = false; - // Allow "load" option to work without --file or --uuid - // option. + // Allow "load" option to work without --file or --uuid option. if (load) { if (!m_file_option.GetOptionValue().OptionWasSet() && !m_uuid_option_group.GetOptionValue().OptionWasSet()) { @@ -2930,9 +2924,8 @@ Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); const bool use_global_module_list = m_options.m_use_global_module_list; // Define a local module list here to ensure it lives longer than any - // "locker" - // object which might lock its contents below (through the "module_list_ptr" - // variable). + // "locker" object which might lock its contents below (through the + // "module_list_ptr" variable). ModuleList module_list; if (target == nullptr && !use_global_module_list) { result.AppendError("invalid target, create a debug target using the " @@ -2980,10 +2973,9 @@ size_t num_modules = 0; // This locker will be locked on the mutex in module_list_ptr if it is - // non-nullptr. - // Otherwise it will lock the AllocationModuleCollectionMutex when - // accessing - // the global module list directly. + // non-nullptr. Otherwise it will lock the + // AllocationModuleCollectionMutex when accessing the global module list + // directly. std::unique_lock guard( Module::GetAllocationModuleCollectionMutex(), std::defer_lock); @@ -3831,9 +3823,9 @@ 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. + // 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. if (LookupHere(m_interpreter, result, syntax_error)) { result.GetOutputStream().EOL(); num_successful_lookups++; @@ -4045,10 +4037,9 @@ if (!module_spec.GetFileSpec() && !module_spec.GetPlatformFileSpec()) module_spec.GetFileSpec().GetFilename() = symbol_fspec.GetFilename(); } - // We now have a module that represents a symbol file - // that can be used for a module that might exist in the - // current target, so we need to find that module in the - // target + // We now have a module that represents a symbol file that can be used + // for a module that might exist in the current target, so we need to + // find that module in the target ModuleList matching_module_list; size_t num_matches = 0; @@ -4074,8 +4065,7 @@ if (num_matches == 0) { // No matches yet, iterate through the module specs to find a UUID - // value that - // we can match up to an image in our target + // value that we can match up to an image in our target const size_t num_symfile_module_specs = symfile_module_specs.GetSize(); for (size_t i = 0; i < num_symfile_module_specs && num_matches == 0; @@ -4095,8 +4085,8 @@ } } - // Just try to match up the file by basename if we have no matches at this - // point + // 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); @@ -4108,7 +4098,8 @@ if (!filename_no_extension) break; - // Check if there was no extension to strip and the basename is the same + // Check if there was no extension to strip and the basename is the + // same if (filename_no_extension == module_spec.GetFileSpec().GetFilename()) break; @@ -4127,9 +4118,9 @@ } 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! + // 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 = @@ -4147,8 +4138,8 @@ "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 + // 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); Index: lldb/trunk/source/Commands/CommandObjectThread.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectThread.cpp +++ lldb/trunk/source/Commands/CommandObjectThread.cpp @@ -104,8 +104,8 @@ } // Use tids instead of ThreadSPs to prevent deadlocking problems which - // result from JIT-ing - // code while iterating over the (locked) ThreadSP list. + // result from JIT-ing code while iterating over the (locked) ThreadSP + // list. std::vector tids; if (all_threads || m_unique_stacks) { @@ -196,11 +196,10 @@ // // If you return false, the iteration will stop, otherwise it will proceed. // The result is set to m_success_return (defaults to - // eReturnStatusSuccessFinishResult) before the iteration, - // so you only need to set the return status in HandleOneThread if you want to - // indicate an error. - // If m_add_return is true, a blank line will be inserted between each of the - // listings (except the last one.) + // eReturnStatusSuccessFinishResult) before the iteration, so you only need + // to set the return status in HandleOneThread if you want to indicate an + // error. If m_add_return is true, a blank line will be inserted between each + // of the listings (except the last one.) virtual bool HandleOneThread(lldb::tid_t, CommandReturnObject &result) = 0; @@ -647,8 +646,7 @@ const lldb::RunMode stop_other_threads = m_options.m_run_mode; // This is a bit unfortunate, but not all the commands in this command - // object support - // only while stepping, so I use the bool for them. + // object support only while stepping, so I use the bool for them. bool bool_stop_other_threads; if (m_options.m_run_mode == eAllThreads) bool_stop_other_threads = false; @@ -753,8 +751,8 @@ } // If we got a new plan, then set it to be a master plan (User level Plans - // should be master plans - // so that they can be interruptible). Then resume the process. + // should be master plans so that they can be interruptible). Then resume + // the process. if (new_plan_sp) { new_plan_sp->SetIsMasterPlan(true); @@ -785,10 +783,9 @@ } // There is a race condition where this thread will return up the call - // stack to the main command handler - // and show an (lldb) prompt before HandlePrivateEvent (from - // PrivateStateThread) has - // a chance to call PushProcessIOHandler(). + // stack to the main command handler and show an (lldb) prompt before + // HandlePrivateEvent (from PrivateStateThread) has a chance to call + // PushProcessIOHandler(). process->SyncIOHandler(iohandler_id, 2000); if (synchronous_execution) { @@ -870,9 +867,9 @@ (state == eStateSuspended)) { const size_t argc = command.GetArgumentCount(); if (argc > 0) { - // These two lines appear at the beginning of both blocks in - // this if..else, but that is because we need to release the - // lock before calling process->Resume below. + // These two lines appear at the beginning of both blocks in this + // if..else, but that is because we need to release the lock before + // calling process->Resume below. std::lock_guard guard( process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); @@ -931,9 +928,9 @@ process->GetID()); } } else { - // These two lines appear at the beginning of both blocks in - // this if..else, but that is because we need to release the - // lock before calling process->Resume below. + // These two lines appear at the beginning of both blocks in this + // if..else, but that is because we need to release the lock before + // calling process->Resume below. std::lock_guard guard( process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); @@ -1195,8 +1192,8 @@ ThreadPlanSP new_plan_sp; if (frame->HasDebugInformation()) { - // Finally we got here... Translate the given line number to a bunch of - // addresses: + // Finally we got here... Translate the given line number to a bunch + // of addresses: SymbolContext sc(frame->GetSymbolContext(eSymbolContextCompUnit)); LineTable *line_table = nullptr; if (sc.comp_unit) @@ -1275,10 +1272,9 @@ abort_other_plans, &address_list.front(), address_list.size(), m_options.m_stop_others, m_options.m_frame_idx); // User level plans should be master plans so they can be interrupted - // (e.g. by hitting a breakpoint) - // and other plans executed by the user (stepping around the breakpoint) - // and then a "continue" - // will resume the original plan. + // (e.g. by hitting a breakpoint) and other plans executed by the user + // (stepping around the breakpoint) and then a "continue" will resume + // the original plan. new_plan_sp->SetIsMasterPlan(true); new_plan_sp->SetOkayToDiscard(false); } else { Index: lldb/trunk/source/Commands/CommandObjectType.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectType.cpp +++ lldb/trunk/source/Commands/CommandObjectType.cpp @@ -1421,8 +1421,8 @@ return result.Succeeded(); } - // if I am here, script_format must point to something good, so I can add that - // as a script summary to all interested parties + // if I am here, script_format must point to something good, so I can add + // that as a script summary to all interested parties Status error; @@ -2757,9 +2757,8 @@ class CommandObjectTypeLookup : public CommandObjectRaw { protected: // this function is allowed to do a more aggressive job at guessing languages - // than the expression parser - // is comfortable with - so leave the original call alone and add one that is - // specific to type lookup + // than the expression parser is comfortable with - so leave the original + // call alone and add one that is specific to type lookup lldb::LanguageType GuessLanguage(StackFrame *frame) { lldb::LanguageType lang_type = lldb::eLanguageTypeUnknown; @@ -2934,9 +2933,8 @@ } // This is not the most efficient way to do this, but we support very few - // languages - // so the cost of the sort is going to be dwarfed by the actual lookup - // anyway + // languages so the cost of the sort is going to be dwarfed by the actual + // lookup anyway if (StackFrame *frame = m_exe_ctx.GetFramePtr()) { guessed_language = GuessLanguage(frame); if (guessed_language != eLanguageTypeUnknown) { Index: lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp +++ lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp @@ -74,8 +74,8 @@ return -1; } -// Return true if wp_ids is successfully populated with the watch ids. -// False otherwise. +// Return true if wp_ids is successfully populated with the watch ids. False +// otherwise. bool CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs( Target *target, Args &args, std::vector &wp_ids) { // Pre-condition: args.GetArgumentCount() > 0. @@ -111,8 +111,8 @@ if (!second.empty()) StrRefArgs.push_back(second); } - // Now process the canonical list and fill in the vector of uint32_t's. - // If there is any error, return false and the client should ignore wp_ids. + // Now process the canonical list and fill in the vector of uint32_t's. If + // there is any error, return false and the client should ignore wp_ids. uint32_t beg, end, id; size_t size = StrRefArgs.size(); bool in_range = false; @@ -848,8 +848,8 @@ Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get(); StackFrame *frame = m_exe_ctx.GetFramePtr(); - // If no argument is present, issue an error message. There's no way to set - // a watchpoint. + // If no argument is present, issue an error message. There's no way to + // set a watchpoint. if (command.GetArgumentCount() <= 0) { result.GetErrorStream().Printf("error: required argument missing; " "specify your program variable to watch " @@ -863,8 +863,8 @@ m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite; } - // We passed the sanity check for the command. - // Proceed to set the watchpoint now. + // We passed the sanity check for the command. Proceed to set the + // watchpoint now. lldb::addr_t addr = 0; size_t size = 0; @@ -1072,8 +1072,8 @@ if (expr == nullptr) expr = raw_command; - // If no argument is present, issue an error message. There's no way to set - // a watchpoint. + // If no argument is present, issue an error message. There's no way to + // set a watchpoint. if (command.GetArgumentCount() == 0) { result.GetErrorStream().Printf("error: required argument missing; " "specify an expression to evaulate into " @@ -1087,8 +1087,8 @@ m_option_watchpoint.watch_type = OptionGroupWatchpoint::eWatchWrite; } - // We passed the sanity check for the command. - // Proceed to set the watchpoint now. + // We passed the sanity check for the command. Proceed to set the + // watchpoint now. lldb::addr_t addr = 0; size_t size = 0; Index: lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp =================================================================== --- lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp +++ lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp @@ -254,11 +254,10 @@ std::unique_ptr data_ap( new WatchpointOptions::CommandData()); - // It's necessary to set both user_source and script_source to the oneliner. - // The former is used to generate callback description (as in watchpoint - // command list) - // while the latter is used for Python to interpret during the actual - // callback. + // It's necessary to set both user_source and script_source to the + // oneliner. The former is used to generate callback description (as in + // watchpoint command list) while the latter is used for Python to + // interpret during the actual callback. data_ap->user_source.AppendString(oneliner); data_ap->script_source.assign(oneliner); data_ap->stop_on_error = m_options.m_stop_on_error; @@ -287,8 +286,8 @@ CommandReturnObject result; Debugger &debugger = target->GetDebugger(); // Rig up the results secondary output stream to the debugger's, so the - // output will come out synchronously - // if the debugger is set up that way. + // output will come out synchronously if the debugger is set up that + // way. StreamSP output_stream(debugger.GetAsyncOutputStream()); StreamSP error_stream(debugger.GetAsyncErrorStream()); @@ -441,20 +440,19 @@ if (wp_options == nullptr) continue; - // If we are using script language, get the script interpreter - // in order to set or collect command callback. Otherwise, call - // the methods associated with this object. + // If we are using script language, get the script interpreter in order + // to set or collect command callback. Otherwise, call the methods + // associated with this object. if (m_options.m_use_script_language) { // Special handling for one-liner specified inline. if (m_options.m_use_one_liner) { m_interpreter.GetScriptInterpreter()->SetWatchpointCommandCallback( wp_options, m_options.m_one_liner.c_str()); } - // Special handling for using a Python function by name - // instead of extending the watchpoint callback data structures, we - // just automatize - // what the user would do manually: make their watchpoint command be a - // function call + // Special handling for using a Python function by name instead of + // extending the watchpoint callback data structures, we just + // automatize what the user would do manually: make their watchpoint + // command be a function call else if (!m_options.m_function_name.empty()) { std::string oneliner(m_options.m_function_name); oneliner += "(frame, wp, internal_dict)"; Index: lldb/trunk/source/Core/Address.cpp =================================================================== --- lldb/trunk/source/Core/Address.cpp +++ lldb/trunk/source/Core/Address.cpp @@ -141,8 +141,8 @@ deref_so_addr)) return true; } else { - // If we were not running, yet able to read an integer, we must - // have a module + // If we were not running, yet able to read an integer, we must have a + // module ModuleSP module_sp(address.GetModule()); assert(module_sp); @@ -151,8 +151,8 @@ } // We couldn't make "deref_addr" into a section offset value, but we were - // able to read the address, so we return a section offset address with - // no section and "deref_addr" as the offset (address). + // able to read the address, so we return a section offset address with no + // section and "deref_addr" as the offset (address). deref_so_addr.SetRawAddress(deref_addr); return true; } @@ -278,12 +278,12 @@ // Section isn't resolved, we can't return a valid file address return LLDB_INVALID_ADDRESS; } - // We have a valid file range, so we can return the file based - // address by adding the file base address to our offset + // We have a valid file range, so we can return the file based address by + // adding the file base address to our offset return sect_file_addr + m_offset; } else if (SectionWasDeletedPrivate()) { - // Used to have a valid section but it got deleted so the - // offset doesn't mean anything without the section + // Used to have a valid section but it got deleted so the offset doesn't + // mean anything without the section return LLDB_INVALID_ADDRESS; } // No section, we just return the offset since it is the value in this case @@ -297,21 +297,21 @@ addr_t sect_load_addr = section_sp->GetLoadBaseAddress(target); if (sect_load_addr != LLDB_INVALID_ADDRESS) { - // We have a valid file range, so we can return the file based - // address by adding the file base address to our offset + // We have a valid file range, so we can return the file based address + // by adding the file base address to our offset return sect_load_addr + m_offset; } } } else if (SectionWasDeletedPrivate()) { - // Used to have a valid section but it got deleted so the - // offset doesn't mean anything without the section + // Used to have a valid section but it got deleted so the offset doesn't + // mean anything without the section return LLDB_INVALID_ADDRESS; } else { // We don't have a section so the offset is the load address return m_offset; } - // The section isn't resolved or an invalid target was passed in - // so we can't return a valid load address. + // The section isn't resolved or an invalid target was passed in so we can't + // return a valid load address. return LLDB_INVALID_ADDRESS; } @@ -375,16 +375,15 @@ bool Address::Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style, uint32_t addr_size) const { // If the section was nullptr, only load address is going to work unless we - // are - // trying to deref a pointer + // are trying to deref a pointer SectionSP section_sp(GetSection()); if (!section_sp && style != DumpStyleResolvedPointerDescription) style = DumpStyleLoadAddress; ExecutionContext exe_ctx(exe_scope); Target *target = exe_ctx.GetTargetPtr(); - // If addr_byte_size is UINT32_MAX, then determine the correct address - // byte size for the process or default to the size of addr_t + // If addr_byte_size is UINT32_MAX, then determine the correct address byte + // size for the process or default to the size of addr_t if (addr_size == UINT32_MAX) { if (target) addr_size = target->GetArchitecture().GetAddressByteSize(); @@ -651,15 +650,15 @@ } } if (show_stop_context) { - // We have a function or a symbol from the same - // sections as this address. + // We have a function or a symbol from the same sections as this + // address. sc.DumpStopContext(s, exe_scope, *this, show_fullpaths, show_module, show_inlined_frames, show_function_arguments, show_function_name); } else { - // We found a symbol but it was in a different - // section so it isn't the symbol we should be - // showing, just show the section name + offset + // We found a symbol but it was in a different section so it + // isn't the symbol we should be showing, just show the section + // name + offset Dump(s, exe_scope, DumpStyleSectionNameOffset); } } @@ -680,10 +679,10 @@ module_sp->ResolveSymbolContextForAddress( *this, eSymbolContextEverything | eSymbolContextVariable, sc); if (sc.symbol) { - // If we have just a symbol make sure it is in the same section - // as our address. If it isn't, then we might have just found - // the last symbol that came before the address that we are - // looking up that has nothing to do with our address lookup. + // If we have just a symbol make sure it is in the same section as + // our address. If it isn't, then we might have just found the last + // symbol that came before the address that we are looking up that + // has nothing to do with our address lookup. if (sc.symbol->ValueIsAddress() && sc.symbol->GetAddressRef().GetSection() != GetSection()) sc.symbol = nullptr; @@ -771,14 +770,11 @@ lldb::SectionWP empty_section_wp; // If either call to "std::weak_ptr::owner_before(...) value returns true, - // this - // indicates that m_section_wp once contained (possibly still does) a - // reference - // to a valid shared pointer. This helps us know if we had a valid reference - // to - // a section which is now invalid because the module it was in was - // unloaded/deleted, - // or if the address doesn't have a valid reference to a section. + // this indicates that m_section_wp once contained (possibly still does) a + // reference to a valid shared pointer. This helps us know if we had a valid + // reference to a section which is now invalid because the module it was in + // was unloaded/deleted, or if the address doesn't have a valid reference to + // a section. return empty_section_wp.owner_before(m_section_wp) || m_section_wp.owner_before(empty_section_wp); } @@ -914,8 +910,8 @@ return -1; if (a_module > b_module) return +1; - // Modules are the same, just compare the file address since they should - // be unique + // Modules are the same, just compare the file address since they should be + // unique addr_t a_file_addr = a.GetFileAddress(); addr_t b_file_addr = b.GetFileAddress(); if (a_file_addr < b_file_addr) @@ -926,24 +922,23 @@ } size_t Address::MemorySize() const { - // Noting special for the memory size of a single Address object, - // it is just the size of itself. + // Noting special for the memory size of a single Address object, it is just + // the size of itself. return sizeof(Address); } //---------------------------------------------------------------------- // NOTE: Be careful using this operator. It can correctly compare two -// addresses from the same Module correctly. It can't compare two -// addresses from different modules in any meaningful way, but it will -// compare the module pointers. +// addresses from the same Module correctly. It can't compare two addresses +// from different modules in any meaningful way, but it will compare the module +// pointers. // // To sum things up: -// - works great for addresses within the same module -// - it works for addresses across multiple modules, but don't expect the +// - works great for addresses within the same module - it works for addresses +// across multiple modules, but don't expect the // address results to make much sense // -// This basically lets Address objects be used in ordered collection -// classes. +// This basically lets Address objects be used in ordered collection classes. //---------------------------------------------------------------------- bool lldb_private::operator<(const Address &lhs, const Address &rhs) { @@ -955,8 +950,8 @@ // Addresses are in the same module, just compare the file addresses return lhs.GetFileAddress() < rhs.GetFileAddress(); } else { - // The addresses are from different modules, just use the module - // pointer value to get consistent ordering + // The addresses are from different modules, just use the module pointer + // value to get consistent ordering return lhs_module < rhs_module; } } @@ -970,8 +965,8 @@ // Addresses are in the same module, just compare the file addresses return lhs.GetFileAddress() > rhs.GetFileAddress(); } else { - // The addresses are from different modules, just use the module - // pointer value to get consistent ordering + // The addresses are from different modules, just use the module pointer + // value to get consistent ordering return lhs_module > rhs_module; } } Index: lldb/trunk/source/Core/AddressResolverName.cpp =================================================================== --- lldb/trunk/source/Core/AddressResolverName.cpp +++ lldb/trunk/source/Core/AddressResolverName.cpp @@ -62,9 +62,8 @@ // FIXME: Right now we look at the module level, and call the module's // "FindFunctions". // Greg says he will add function tables, maybe at the CompileUnit level to -// accelerate function -// lookup. At that point, we should switch the depth to CompileUnit, and look -// in these tables. +// accelerate function lookup. At that point, we should switch the depth to +// CompileUnit, and look in these tables. Searcher::CallbackReturn AddressResolverName::SearchCallback(SearchFilter &filter, Index: lldb/trunk/source/Core/Broadcaster.cpp =================================================================== --- lldb/trunk/source/Core/Broadcaster.cpp +++ lldb/trunk/source/Core/Broadcaster.cpp @@ -74,9 +74,8 @@ void Broadcaster::BroadcasterImpl::Clear() { std::lock_guard guard(m_listeners_mutex); - // Make sure the listener forgets about this broadcaster. We do - // this in the broadcaster in case the broadcaster object initiates - // the removal. + // Make sure the listener forgets about this broadcaster. We do this in the + // broadcaster in case the broadcaster object initiates the removal. for (auto &pair : GetListeners()) pair.first->BroadcasterWillDestruct(&m_broadcaster); Index: lldb/trunk/source/Core/Communication.cpp =================================================================== --- lldb/trunk/source/Core/Communication.cpp +++ lldb/trunk/source/Core/Communication.cpp @@ -97,15 +97,15 @@ lldb::ConnectionSP connection_sp(m_connection_sp); if (connection_sp) { ConnectionStatus status = connection_sp->Disconnect(error_ptr); - // We currently don't protect connection_sp with any mutex for - // multi-threaded environments. So lets not nuke our connection class - // without putting some multi-threaded protections in. We also probably - // don't want to pay for the overhead it might cause if every time we - // access the connection we have to take a lock. + // We currently don't protect connection_sp with any mutex for multi- + // threaded environments. So lets not nuke our connection class without + // putting some multi-threaded protections in. We also probably don't want + // to pay for the overhead it might cause if every time we access the + // connection we have to take a lock. // - // This unique pointer will cleanup after itself when this object goes away, - // so there is no need to currently have it destroy itself immediately - // upon disconnnect. + // This unique pointer will cleanup after itself when this object goes + // away, so there is no need to currently have it destroy itself + // immediately upon disconnnect. // connection_sp.reset(); return status; } @@ -240,8 +240,8 @@ size_t Communication::GetCachedBytes(void *dst, size_t dst_len) { std::lock_guard guard(m_bytes_mutex); if (!m_bytes.empty()) { - // If DST is nullptr and we have a thread, then return the number - // of bytes that are available so the caller can call again + // If DST is nullptr and we have a thread, then return the number of bytes + // that are available so the caller can call again if (dst == nullptr) return m_bytes.size(); @@ -337,8 +337,7 @@ case eConnectionStatusInterrupted: // Synchronization signal from // SynchronizeWithReadThread() // The connection returns eConnectionStatusInterrupted only when there is - // no - // input pending to be read, so we can signal that. + // no input pending to be read, so we can signal that. comm->BroadcastEvent(eBroadcastBitNoMorePendingInput); break; case eConnectionStatusNoConnection: // No connection Index: lldb/trunk/source/Core/Debugger.cpp =================================================================== --- lldb/trunk/source/Core/Debugger.cpp +++ lldb/trunk/source/Core/Debugger.cpp @@ -167,13 +167,15 @@ "}${addr-file-or-load}{ " \ "<${function.concrete-only-addr-offset-no-padding}>}: " -// gdb's disassembly format can be emulated with -// ${current-pc-arrow}${addr-file-or-load}{ -// <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}: +// gdb's disassembly format can be emulated with ${current-pc-arrow}${addr- +// file-or-load}{ <${function.name-without-args}${function.concrete-only-addr- +// offset-no-padding}>}: // lldb's original format for disassembly would look like this format string - -// {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} -// }{${addr-file-or-load}}: +// {${function.initial-function}{${module.file.basename}`}{${function.name- +// without- +// args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name- +// without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: #define DEFAULT_STOP_SHOW_COLUMN_ANSI_PREFIX "${ansi.underline}" #define DEFAULT_STOP_SHOW_COLUMN_ANSI_SUFFIX "${ansi.normal}" @@ -590,9 +592,9 @@ return true; } } else { - // The g_load_plugin_callback is registered in SBDebugger::Initialize() - // and if the public API layer isn't available (code is linking against - // all of the internal LLDB static libraries), then we can't load plugins + // The g_load_plugin_callback is registered in SBDebugger::Initialize() and + // if the public API layer isn't available (code is linking against all of + // the internal LLDB static libraries), then we can't load plugins error.SetErrorString("Public API layer is not available"); } return false; @@ -612,8 +614,8 @@ Debugger *debugger = (Debugger *)baton; namespace fs = llvm::sys::fs; - // If we have a regular file, a symbolic link or unknown file type, try - // and process the file. We must handle unknown as sometimes the directory + // If we have a regular file, a symbolic link or unknown file type, try and + // process the file. We must handle unknown as sometimes the directory // enumeration might be enumerating a file system that doesn't have correct // file type information. if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || @@ -633,9 +635,9 @@ } else if (ft == fs::file_type::directory_file || ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { - // Try and recurse into anything that a directory or symbolic link. - // We must also do this for unknown as sometimes the directory enumeration - // might be enumerating a file system that doesn't have correct file type + // Try and recurse into anything that a directory or symbolic link. We must + // also do this for unknown as sometimes the directory enumeration might be + // enumerating a file system that doesn't have correct file type // information. return FileSpec::eEnumerateDirectoryResultEnter; } @@ -800,10 +802,9 @@ void Debugger::Clear() { //---------------------------------------------------------------------- - // Make sure we call this function only once. With the C++ global - // destructor chain having a list of debuggers and with code that can be - // running on other threads, we need to ensure this doesn't happen - // multiple times. + // Make sure we call this function only once. With the C++ global destructor + // chain having a list of debuggers and with code that can be running on + // other threads, we need to ensure this doesn't happen multiple times. // // The following functions call Debugger::Clear(): // Debugger::~Debugger(); @@ -828,8 +829,7 @@ m_broadcaster_manager_sp->Clear(); // Close the input file _before_ we close the input read communications - // class - // as it does NOT own the input file, our m_input_file does. + // class as it does NOT own the input file, our m_input_file does. m_terminal_state.Clear(); if (m_input_file_sp) m_input_file_sp->GetFile().Close(); @@ -865,8 +865,8 @@ if (!in_file.IsValid()) in_file.SetStream(stdin, true); - // Save away the terminal state if that is relevant, so that we can restore it - // in RestoreInputState. + // Save away the terminal state if that is relevant, so that we can restore + // it in RestoreInputState. SaveInputTerminalState(); } @@ -880,8 +880,8 @@ if (!out_file.IsValid()) out_file.SetStream(stdout, false); - // do not create the ScriptInterpreter just for setting the output file handle - // as the constructor will know how to do the right thing on its own + // do not create the ScriptInterpreter just for setting the output file + // handle as the constructor will know how to do the right thing on its own const bool can_create = false; ScriptInterpreter *script_interpreter = GetCommandInterpreter().GetScriptInterpreter(can_create); @@ -1027,11 +1027,10 @@ void Debugger::AdoptTopIOHandlerFilesIfInvalid(StreamFileSP &in, StreamFileSP &out, StreamFileSP &err) { - // Before an IOHandler runs, it must have in/out/err streams. - // This function is called when one ore more of the streams - // are nullptr. We use the top input reader's in/out/err streams, - // or fall back to the debugger file handles, or we fall back - // onto stdin/stdout/stderr as a last resort. + // Before an IOHandler runs, it must have in/out/err streams. This function + // is called when one ore more of the streams are nullptr. We use the top + // input reader's in/out/err streams, or fall back to the debugger file + // handles, or we fall back onto stdin/stdout/stderr as a last resort. std::lock_guard guard(m_input_reader_stack.GetMutex()); IOHandlerSP top_reader_sp(m_input_reader_stack.Top()); @@ -1087,8 +1086,8 @@ m_input_reader_stack.Push(reader_sp); reader_sp->Activate(); - // Interrupt the top input reader to it will exit its Run() function - // and let this new input reader take over + // Interrupt the top input reader to it will exit its Run() function and let + // this new input reader take over if (top_reader_sp) { top_reader_sp->Deactivate(); top_reader_sp->Cancel(); @@ -1101,8 +1100,8 @@ std::lock_guard guard(m_input_reader_stack.GetMutex()); - // The reader on the stop of the stack is done, so let the next - // read on the stack refresh its prompt and if there is one... + // The reader on the stop of the stack is done, so let the next read on the + // stack refresh its prompt and if there is one... if (m_input_reader_stack.IsEmpty()) return false; @@ -1197,8 +1196,8 @@ } } } - // The first context on a list of instructions will have a prev_sc that - // has no Function or Symbol -- if SymbolContext had an IsValid() method, it + // The first context on a list of instructions will have a prev_sc that has + // no Function or Symbol -- if SymbolContext had an IsValid() method, it // would return false. But we do get a prev_sc pointer. if ((sc && (sc->function || sc->symbol)) && prev_sc && (prev_sc->function == nullptr && prev_sc->symbol == nullptr)) { @@ -1464,8 +1463,8 @@ } void Debugger::HandleThreadEvent(const EventSP &event_sp) { - // At present the only thread event we handle is the Frame Changed event, - // and all we do for that is just reprint the thread status for that thread. + // At present the only thread event we handle is the Frame Changed event, and + // all we do for that is just reprint the thread status for that thread. using namespace lldb; const uint32_t event_type = event_sp->GetType(); const bool stop_format = true; @@ -1518,8 +1517,8 @@ CommandInterpreter::eBroadcastBitAsynchronousOutputData | CommandInterpreter::eBroadcastBitAsynchronousErrorData); - // Let the thread that spawned us know that we have started up and - // that we are now listening to all required events so no events get missed + // Let the thread that spawned us know that we have started up and that we + // are now listening to all required events so no events get missed m_sync_broadcaster.BroadcastEvent(eBroadcastBitEventThreadIsListening); bool done = false; @@ -1584,9 +1583,9 @@ bool Debugger::StartEventHandlerThread() { if (!m_event_handler_thread.IsJoinable()) { - // We must synchronize with the DefaultEventHandler() thread to ensure - // it is up and running and listening to events before we return from - // this function. We do this by listening to events for the + // We must synchronize with the DefaultEventHandler() thread to ensure it + // is up and running and listening to events before we return from this + // function. We do this by listening to events for the // eBroadcastBitEventThreadIsListening from the m_sync_broadcaster ListenerSP listener_sp( Listener::MakeListener("lldb.debugger.event-handler")); @@ -1598,13 +1597,11 @@ "lldb.debugger.event-handler", EventHandlerThread, this, nullptr, g_debugger_event_thread_stack_bytes); - // Make sure DefaultEventHandler() is running and listening to events before - // we return - // from this function. We are only listening for events of type - // eBroadcastBitEventThreadIsListening so we don't need to check the event, - // we just need - // to wait an infinite amount of time for it (nullptr timeout as the first - // parameter) + // Make sure DefaultEventHandler() is running and listening to events + // before we return from this function. We are only listening for events of + // type eBroadcastBitEventThreadIsListening so we don't need to check the + // event, we just need to wait an infinite amount of time for it (nullptr + // timeout as the first parameter) lldb::EventSP event_sp; listener_sp->GetEvent(event_sp, llvm::None); } Index: lldb/trunk/source/Core/Disassembler.cpp =================================================================== --- lldb/trunk/source/Core/Disassembler.cpp +++ lldb/trunk/source/Core/Disassembler.cpp @@ -96,8 +96,8 @@ const char *plugin_name) { if (target_sp && flavor == nullptr) { // FIXME - we don't have the mechanism in place to do per-architecture - // settings. But since we know that for now - // we only support flavors on x86 & x86_64, + // settings. But since we know that for now we only support flavors on x86 + // & x86_64, if (arch.GetTriple().getArch() == llvm::Triple::x86 || arch.GetTriple().getArch() == llvm::Triple::x86_64) flavor = target_sp->GetDisassemblyFlavor(); @@ -108,8 +108,8 @@ static void ResolveAddress(const ExecutionContext &exe_ctx, const Address &addr, Address &resolved_addr) { if (!addr.IsSectionOffset()) { - // If we weren't passed in a section offset address range, - // try and resolve it to something + // If we weren't passed in a section offset address range, try and resolve + // it to something Target *target = exe_ctx.GetTargetPtr(); if (target) { if (target->GetSectionLoadList().IsEmpty()) { @@ -118,8 +118,7 @@ target->GetSectionLoadList().ResolveLoadAddress(addr.GetOffset(), resolved_addr); } - // We weren't able to resolve the address, just treat it as a - // raw address + // We weren't able to resolve the address, just treat it as a raw address if (resolved_addr.IsValid()) return; } @@ -410,15 +409,13 @@ disassembly_format = &format; } - // First pass: step through the list of instructions, - // find how long the initial addresses strings are, insert padding - // in the second pass so the opcodes all line up nicely. + // First pass: step through the list of instructions, find how long the + // initial addresses strings are, insert padding in the second pass so the + // opcodes all line up nicely. // Also build up the source line mapping if this is mixed source & assembly - // mode. - // Calculate the source line for each assembly instruction (eliding inlined - // functions - // which the user wants to skip). + // mode. Calculate the source line for each assembly instruction (eliding + // inlined functions which the user wants to skip). std::map> source_lines_seen; Symbol *previous_symbol = nullptr; @@ -495,17 +492,13 @@ if (mixed_source_and_assembly) { // If we've started a new function (non-inlined), print all of the - // source lines from the - // function declaration until the first line table entry - typically - // the opening curly brace of - // the function. + // source lines from the function declaration until the first line + // table entry - typically the opening curly brace of the function. if (previous_symbol != sc.symbol) { - // The default disassembly format puts an extra blank line between - // functions - so - // when we're displaying the source context for a function, we - // don't want to add - // a blank line after the source context or we'll end up with two - // of them. + // The default disassembly format puts an extra blank line + // between functions - so when we're displaying the source + // context for a function, we don't want to add a blank line + // after the source context or we'll end up with two of them. if (previous_symbol != nullptr) source_lines_to_display.print_source_context_end_eol = false; @@ -520,9 +513,9 @@ func_decl_line); if (func_decl_file == prologue_end_line.file || func_decl_file == prologue_end_line.original_file) { - // Add all the lines between the function declaration - // and the first non-prologue source line to the list - // of lines to print. + // Add all the lines between the function declaration and + // the first non-prologue source line to the list of lines + // to print. for (uint32_t lineno = func_decl_line; lineno <= prologue_end_line.line; lineno++) { SourceLine this_line; @@ -530,8 +523,8 @@ this_line.line = lineno; source_lines_to_display.lines.push_back(this_line); } - // Mark the last line as the "current" one. Usually - // this is the open curly brace. + // Mark the last line as the "current" one. Usually this + // is the open curly brace. if (source_lines_to_display.lines.size() > 0) source_lines_to_display.current_source_line = source_lines_to_display.lines.size() - 1; @@ -542,8 +535,8 @@ current_source_line_range); } - // If we've left a previous source line's address range, print a new - // source line + // If we've left a previous source line's address range, print a + // new source line if (!current_source_line_range.ContainsFileAddress(addr)) { sc.GetAddressRange(scope, 0, use_inline_block_range, current_source_line_range); @@ -558,8 +551,8 @@ // Only print this source line if it is different from the // last source line we printed. There may have been inlined // functions between these lines that we elided, resulting in - // the same line being printed twice in a row for a contiguous - // block of assembly instructions. + // the same line being printed twice in a row for a + // contiguous block of assembly instructions. if (this_line != previous_line) { std::vector previous_lines; @@ -710,16 +703,16 @@ if (show_bytes) { if (m_opcode.GetType() == Opcode::eTypeBytes) { - // x86_64 and i386 are the only ones that use bytes right now so - // pad out the byte dump to be able to always show 15 bytes (3 chars each) - // plus a space + // x86_64 and i386 are the only ones that use bytes right now so pad out + // the byte dump to be able to always show 15 bytes (3 chars each) plus a + // space if (max_opcode_byte_size > 0) m_opcode.Dump(&ss, max_opcode_byte_size * 3 + 1); else m_opcode.Dump(&ss, 15 * 3 + 1); } else { - // Else, we have ARM or MIPS which can show up to a uint32_t - // 0x00000000 (10 spaces) plus two for padding... + // Else, we have ARM or MIPS which can show up to a uint32_t 0x00000000 + // (10 spaces) plus two for padding... if (max_opcode_byte_size > 0) m_opcode.Dump(&ss, max_opcode_byte_size * 3 + 1); else @@ -903,7 +896,8 @@ option_value_sp.reset(); return option_value_sp; } - // We've used the data_type to read an array; re-set the type to Invalid + // We've used the data_type to read an array; re-set the type to + // Invalid data_type = OptionValue::eTypeInvalid; } else if ((value[0] == '0') && (value[1] == 'x')) { value_sp = std::make_shared(0, 0); @@ -1107,9 +1101,9 @@ } } - // Hexagon needs the first instruction of the packet with the branch. - // Go backwards until we find an instruction marked end-of-packet, or - // until we hit start. + // Hexagon needs the first instruction of the packet with the branch. Go + // backwards until we find an instruction marked end-of-packet, or until we + // hit start. if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon) { // If we didn't find a branch, find the last packet start. if (next_branch == UINT32_MAX) { @@ -1128,8 +1122,8 @@ // If we have an error reading memory, return start if (!error.Success()) return start; - // check if this is the last instruction in a packet - // bits 15:14 will be 11b or 00b for a duplex + // check if this is the last instruction in a packet bits 15:14 will be + // 11b or 00b for a duplex if (((inst_bytes & 0xC000) == 0xC000) || ((inst_bytes & 0xC000) == 0x0000)) { // instruction after this should be the start of next packet @@ -1257,8 +1251,7 @@ m_flavor.assign(flavor); // If this is an arm variant that can only include thumb (T16, T32) - // instructions, force the arch triple to be "thumbv.." instead of - // "armv..." + // instructions, force the arch triple to be "thumbv.." instead of "armv..." if (arch.IsAlwaysThumbInstructions()) { std::string thumb_arch_name(arch.GetTriple().getArchName().str()); // Replace "arm" with "thumb" so we get all thumb variants correct Index: lldb/trunk/source/Core/DumpDataExtractor.cpp =================================================================== --- lldb/trunk/source/Core/DumpDataExtractor.cpp +++ lldb/trunk/source/Core/DumpDataExtractor.cpp @@ -239,8 +239,8 @@ if (item_byte_size <= 8) { uint64_t uval64 = DE.GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset); - // Avoid std::bitset<64>::to_string() since it is missing in - // earlier C++ libraries + // Avoid std::bitset<64>::to_string() since it is missing in earlier + // C++ libraries std::string binary_value(64, '0'); std::bitset<64> bits(uval64); for (uint32_t i = 0; i < 64; ++i) @@ -263,8 +263,8 @@ s->Printf("%2.2x", DE.GetU8(&offset)); } - // Put an extra space between the groups of bytes if more than one - // is being dumped in a group (item_byte_size is more than 1). + // Put an extra space between the groups of bytes if more than one is + // being dumped in a group (item_byte_size is more than 1). if (item_byte_size > 1) s->PutChar(' '); break; @@ -279,8 +279,7 @@ return offset; } - // If we are only printing one character surround it with single - // quotes + // If we are only printing one character surround it with single quotes if (item_count == 1 && item_format == eFormatChar) s->PutChar('\''); @@ -693,10 +692,9 @@ break; // please keep the single-item formats below in sync with - // FormatManager::GetSingleItemFormat - // if you fail to do so, users will start getting different outputs - // depending on internal - // implementation details they should not care about || + // FormatManager::GetSingleItemFormat if you fail to do so, users will + // start getting different outputs depending on internal implementation + // details they should not care about || case eFormatVectorOfChar: // || s->PutChar('{'); // \/ offset = Index: lldb/trunk/source/Core/DynamicLoader.cpp =================================================================== --- lldb/trunk/source/Core/DynamicLoader.cpp +++ lldb/trunk/source/Core/DynamicLoader.cpp @@ -64,8 +64,8 @@ DynamicLoader::~DynamicLoader() = default; //---------------------------------------------------------------------- -// Accessosors to the global setting as to whether to stop at image -// (shared library) loading/unloading. +// Accessosors to the global setting as to whether to stop at image (shared +// library) loading/unloading. //---------------------------------------------------------------------- bool DynamicLoader::GetStopWhenImagesChange() const { @@ -86,8 +86,8 @@ executable->GetArchitecture()); auto module_sp = std::make_shared(module_spec); - // Check if the executable has changed and set it to the target executable - // if they differ. + // Check if the executable has changed and set it to the target + // executable if they differ. if (module_sp && module_sp->GetUUID().IsValid() && executable->GetUUID().IsValid()) { if (module_sp->GetUUID() != executable->GetUUID()) @@ -99,8 +99,8 @@ if (!executable) { executable = target.GetSharedModule(module_spec); if (executable.get() != target.GetExecutableModulePointer()) { - // Don't load dependent images since we are in dyld where we will know - // and find out about all images that are loaded + // Don't load dependent images since we are in dyld where we will + // know and find out about all images that are loaded const bool get_dependent_images = false; target.SetExecutableModule(executable, get_dependent_images); } @@ -177,8 +177,8 @@ bool check_alternative_file_name = true; if (base_addr_is_offset) { // Try to fetch the load address of the file from the process as we need - // absolute load - // address to read the file out of the memory instead of a load bias. + // absolute load address to read the file out of the memory instead of a + // load bias. bool is_loaded = false; lldb::addr_t load_addr; Status error = m_process->GetFileLoadAddress(file, is_loaded, load_addr); @@ -188,9 +188,8 @@ } } - // We failed to find the module based on its name. Lets try to check if we can - // find a - // different name based on the memory region info. + // We failed to find the module based on its name. Lets try to check if we + // can find a different name based on the memory region info. if (check_alternative_file_name) { MemoryRegionInfo memory_info; Status error = m_process->GetMemoryRegionInfo(base_addr, memory_info); Index: lldb/trunk/source/Core/FileLineResolver.cpp =================================================================== --- lldb/trunk/source/Core/FileLineResolver.cpp +++ lldb/trunk/source/Core/FileLineResolver.cpp @@ -54,8 +54,8 @@ while (file_idx != UINT32_MAX) { line_table->FineLineEntriesForFileIndex(file_idx, append, m_sc_list); - // Get the next file index in case we have multiple file - // entries for the same file + // Get the next file index in case we have multiple file entries + // for the same file file_idx = cu->GetSupportFiles().FindFileIndex(file_idx + 1, m_file_spec, false); } Index: lldb/trunk/source/Core/FileSpecList.cpp =================================================================== --- lldb/trunk/source/Core/FileSpecList.cpp +++ lldb/trunk/source/Core/FileSpecList.cpp @@ -42,11 +42,10 @@ } //------------------------------------------------------------------ -// Only append the "file_spec" if this list doesn't already contain -// it. +// Only append the "file_spec" if this list doesn't already contain it. // -// Returns true if "file_spec" was added, false if this list already -// contained a copy of "file_spec". +// Returns true if "file_spec" was added, false if this list already contained +// a copy of "file_spec". //------------------------------------------------------------------ bool FileSpecList::AppendIfUnique(const FileSpec &file_spec) { collection::iterator end = m_files.end(); @@ -75,18 +74,18 @@ } //------------------------------------------------------------------ -// Find the index of the file in the file spec list that matches -// "file_spec" starting "start_idx" entries into the file spec list. +// Find the index of the file in the file spec list that matches "file_spec" +// starting "start_idx" entries into the file spec list. // -// Returns the valid index of the file that matches "file_spec" if -// it is found, else std::numeric_limits::max() is returned. +// Returns the valid index of the file that matches "file_spec" if it is found, +// else std::numeric_limits::max() is returned. //------------------------------------------------------------------ size_t FileSpecList::FindFileIndex(size_t start_idx, const FileSpec &file_spec, bool full) const { const size_t num_files = m_files.size(); - // When looking for files, we will compare only the filename if the - // FILE_SPEC argument is empty + // When looking for files, we will compare only the filename if the FILE_SPEC + // argument is empty bool compare_filename_only = file_spec.GetDirectory().IsEmpty(); for (size_t idx = start_idx; idx < num_files; ++idx) { @@ -106,8 +105,8 @@ } //------------------------------------------------------------------ -// Returns the FileSpec object at index "idx". If "idx" is out of -// range, then an empty FileSpec object will be returned. +// Returns the FileSpec object at index "idx". If "idx" is out of range, then +// an empty FileSpec object will be returned. //------------------------------------------------------------------ const FileSpec &FileSpecList::GetFileSpecAtIndex(size_t idx) const { if (idx < m_files.size()) @@ -123,11 +122,10 @@ } //------------------------------------------------------------------ -// Return the size in bytes that this object takes in memory. This -// returns the size in bytes of this object's member variables and -// any FileSpec objects its member variables contain, the result -// doesn't not include the string values for the directories any -// filenames as those are in shared string pools. +// Return the size in bytes that this object takes in memory. This returns the +// size in bytes of this object's member variables and any FileSpec objects its +// member variables contain, the result doesn't not include the string values +// for the directories any filenames as those are in shared string pools. //------------------------------------------------------------------ size_t FileSpecList::MemorySize() const { size_t mem_size = sizeof(FileSpecList); Index: lldb/trunk/source/Core/FormatEntity.cpp =================================================================== --- lldb/trunk/source/Core/FormatEntity.cpp +++ lldb/trunk/source/Core/FormatEntity.cpp @@ -467,10 +467,9 @@ if (sc->function) { func_addr = sc->function->GetAddressRange().GetBaseAddress(); if (sc->block && !concrete_only) { - // Check to make sure we aren't in an inline - // function. If we are, use the inline block - // range that contains "format_addr" since - // blocks can be discontiguous. + // Check to make sure we aren't in an inline function. If we are, use + // the inline block range that contains "format_addr" since blocks + // can be discontiguous. Block *inline_block = sc->block->GetContainingInlinedBlock(); AddressRange inline_range; if (inline_block && @@ -822,8 +821,7 @@ if (do_deref_pointer && !is_array_range) { // I have not deref-ed yet, let's do it // this happens when we are not going through - // GetValueForVariableExpressionPath - // to get to the target ValueObject + // GetValueForVariableExpressionPath to get to the target ValueObject Status error; target = target->Dereference(error).get(); if (error.Fail()) { @@ -842,9 +840,9 @@ return false; } - // we do not want to use the summary for a bitfield of type T:n - // if we were originally dealing with just a T - that would get - // us into an endless recursion + // we do not want to use the summary for a bitfield of type T:n if we were + // originally dealing with just a T - that would get us into an endless + // recursion if (target->IsBitfield() && was_var_indexed) { // TODO: check for a (T:n)-specific summary - we should still obey that StreamString bitfield_name; @@ -905,8 +903,7 @@ } // if directly trying to print ${var}, and this is an aggregate, display a - // nice - // type @ location message + // nice type @ location message if (is_aggregate && was_plain_var) { s << target->GetTypeName() << " @ " << target->GetLocationAsCString(); return true; @@ -1142,8 +1139,8 @@ if (!success) break; } - // Only if all items in a scope succeed, then do we - // print the output into the main stream + // Only if all items in a scope succeed, then do we print the output into + // the main stream if (success) s.Write(scope_stream.GetString().data(), scope_stream.GetString().size()); } @@ -1206,9 +1203,8 @@ // Watch for the special "tid" format... if (entry.printf_format == "tid") { // TODO(zturner): Rather than hardcoding this to be platform - // specific, it should be controlled by a - // setting and the default value of the setting can be different - // depending on the platform. + // specific, it should be controlled by a setting and the default + // value of the setting can be different depending on the platform. Target &target = thread->GetProcess()->GetTarget(); ArchSpec arch(target.GetArchitecture()); llvm::Triple::OSType ostype = arch.IsValid() @@ -1914,9 +1910,9 @@ error.SetErrorStringWithFormat("%s", error_strm.GetData()); } else if (sep_char == ':') { // Any value whose separator is a with a ':' means this value has a - // string argument - // that needs to be stored in the entry (like "${script.var:}"). - // In this case the string value is the empty string which is ok. + // string argument that needs to be stored in the entry (like + // "${script.var:}"). In this case the string value is the empty + // string which is ok. } else { error.SetErrorStringWithFormat("%s", "invalid entry definitions"); } @@ -1926,8 +1922,7 @@ error = ParseEntry(value, entry_def, entry); } else if (sep_char == ':') { // Any value whose separator is a with a ':' means this value has a - // string argument - // that needs to be stored in the entry (like + // string argument that needs to be stored in the entry (like // "${script.var:modulename.function}") entry.string = value.str(); } else { @@ -2065,17 +2060,17 @@ case '0': // 1 to 3 octal chars { - // Make a string that can hold onto the initial zero char, - // up to 3 octal digits, and a terminating NULL. + // Make a string that can hold onto the initial zero char, up to 3 + // octal digits, and a terminating NULL. char oct_str[5] = {0, 0, 0, 0, 0}; int i; for (i = 0; (format[i] >= '0' && format[i] <= '7') && i < 4; ++i) oct_str[i] = format[i]; - // We don't want to consume the last octal character since - // the main for loop will do this for us, so we advance p by - // one less than i (even if i is zero) + // We don't want to consume the last octal character since the main + // for loop will do this for us, so we advance p by one less than i + // (even if i is zero) format = format.drop_front(i); unsigned long octal_value = ::strtoul(oct_str, nullptr, 8); if (octal_value <= UINT8_MAX) { @@ -2115,8 +2110,8 @@ break; default: - // Just desensitize any other character by just printing what - // came after the '\' + // Just desensitize any other character by just printing what came + // after the '\' parent_entry.AppendChar(desens_char); break; } @@ -2142,10 +2137,9 @@ if (!variable_format.empty()) { entry.printf_format = variable_format.str(); - // If the format contains a '%' we are going to assume this is - // a printf style format. So if you want to format your thread ID - // using "0x%llx" you can use: - // ${thread.id%0x%llx} + // If the format contains a '%' we are going to assume this is a + // printf style format. So if you want to format your thread ID + // using "0x%llx" you can use: ${thread.id%0x%llx} // // If there is no '%' in the format, then it is assumed to be a // LLDB format name, or one of the extended formats specified in @@ -2264,9 +2258,9 @@ return error; } } - // Check if this entry just wants to insert a constant string - // value into the parent_entry, if so, insert the string with - // AppendText, else append the entry to the parent_entry. + // Check if this entry just wants to insert a constant string value + // into the parent_entry, if so, insert the string with AppendText, + // else append the entry to the parent_entry. if (entry.type == Entry::Type::InsertString) parent_entry.AppendText(entry.string.c_str()); else Index: lldb/trunk/source/Core/IOHandler.cpp =================================================================== --- lldb/trunk/source/Core/IOHandler.cpp +++ lldb/trunk/source/Core/IOHandler.cpp @@ -256,9 +256,8 @@ matches.LongestCommonPrefix(common_prefix); const size_t partial_name_len = strlen(word_start); - // If we matched a unique single command, add a space... - // Only do this if the completer told us this was a complete word, - // however... + // If we matched a unique single command, add a space... Only do this if + // the completer told us this was a complete word, however... if (num_matches == 1 && word_complete) { common_prefix.push_back(' '); } @@ -321,8 +320,7 @@ const char *indent_chars = delegate.IOHandlerGetFixIndentationCharacters(); if (indent_chars) { // The delegate does support indentation, hook it up so when any - // indentation - // character is typed, the delegate gets a chance to fix it + // indentation character is typed, the delegate gets a chance to fix it m_editline_ap->SetFixIndentationCallback(FixIndentationCallback, this, indent_chars); } @@ -408,8 +406,8 @@ } } m_editing = false; - // We might have gotten a newline on a line by itself - // make sure to return true in this case. + // We might have gotten a newline on a line by itself make sure to return + // true in this case. return got_line; } else { // No more input file, we are done... @@ -545,9 +543,8 @@ return success; } -// Each IOHandler gets to run until it is done. It should read data -// from the "in" and place output into "out" and "err and return -// when done. +// Each IOHandler gets to run until it is done. It should read data from the +// "in" and place output into "out" and "err and return when done. void IOHandlerEditline::Run() { std::string line; while (IsActive()) { @@ -635,8 +632,7 @@ } } -// we may want curses to be disabled for some builds -// for instance, windows +// we may want curses to be disabled for some builds for instance, windows #ifndef LLDB_DISABLE_CURSES #define KEY_RETURN 10 @@ -738,9 +734,8 @@ origin.y += h; } - // Return a status bar rectangle which is the last line of - // this rectangle. This rectangle will be modified to not - // include the status bar area. + // Return a status bar rectangle which is the last line of this rectangle. + // This rectangle will be modified to not include the status bar area. Rect MakeStatusBar() { Rect status_bar; if (size.height > 1) { @@ -753,9 +748,8 @@ return status_bar; } - // Return a menubar rectangle which is the first line of - // this rectangle. This rectangle will be modified to not - // include the menubar area. + // Return a menubar rectangle which is the first line of this rectangle. This + // rectangle will be modified to not include the menubar area. Rect MakeMenuBar() { Rect menubar; if (size.height > 1) { @@ -1204,12 +1198,10 @@ return result; } - // Then check for any windows that want any keys - // that weren't handled. This is typically only - // for a menubar. - // Make a copy of the subwindows in case any HandleChar() - // functions muck with the subwindows. If we don't do this, - // we can crash when iterating over the subwindows. + // Then check for any windows that want any keys that weren't handled. This + // is typically only for a menubar. Make a copy of the subwindows in case + // any HandleChar() functions muck with the subwindows. If we don't do + // this, we can crash when iterating over the subwindows. Windows subwindows(m_subwindows); for (auto subwindow_sp : subwindows) { if (!subwindow_sp->m_can_activate) { @@ -1396,8 +1388,8 @@ } MenuActionResult Action() { - // Call the recursive action so it can try to handle it - // with the menu delegate, and if not, try our parent menu + // Call the recursive action so it can try to handle it with the menu + // delegate, and if not, try our parent menu return ActionPrivate(*this); } @@ -1666,9 +1658,9 @@ } if (run_menu_sp) { - // Run the action on this menu in case we need to populate the - // menu with dynamic content and also in case check marks, and - // any other menu decorations need to be calculated + // Run the action on this menu in case we need to populate the menu with + // dynamic content and also in case check marks, and any other menu + // decorations need to be calculated if (run_menu_sp->Action() == MenuActionResult::Quit) return eQuitApplication; @@ -1782,12 +1774,11 @@ bool done = false; int delay_in_tenths_of_a_second = 1; - // Alas the threading model in curses is a bit lame so we need to - // resort to polling every 0.5 seconds. We could poll for stdin - // ourselves and then pass the keys down but then we need to - // translate all of the escape sequences ourselves. So we resort to - // polling for input because we need to receive async process events - // while in this loop. + // Alas the threading model in curses is a bit lame so we need to resort to + // polling every 0.5 seconds. We could poll for stdin ourselves and then + // pass the keys down but then we need to translate all of the escape + // sequences ourselves. So we resort to polling for input because we need + // to receive async process events while in this loop. halfdelay(delay_in_tenths_of_a_second); // Poll using some number of tenths // of seconds seconds when calling @@ -1808,9 +1799,9 @@ while (!done) { if (update) { m_window_sp->Draw(false); - // All windows should be calling Window::DeferredRefresh() instead - // of Window::Refresh() so we can do a single update and avoid - // any screen blinking + // All windows should be calling Window::DeferredRefresh() instead of + // Window::Refresh() so we can do a single update and avoid any screen + // blinking update_panels(); // Cursor hiding isn't working on MacOSX, so hide it in the top left @@ -1822,8 +1813,8 @@ } #if defined(__APPLE__) - // Terminal.app doesn't map its function keys correctly, F1-F4 default to: - // \033OP, \033OQ, \033OR, \033OS, so lets take care of this here if + // Terminal.app doesn't map its function keys correctly, F1-F4 default + // to: \033OP, \033OQ, \033OR, \033OS, so lets take care of this here if // possible int ch; if (escape_chars.empty()) @@ -1986,8 +1977,8 @@ parent->DrawTreeForChild(window, this, 0); if (might_have_children) { - // It we can get UTF8 characters to work we should try to use the "symbol" - // UTF8 string below + // It we can get UTF8 characters to work we should try to use the + // "symbol" UTF8 string below // const char *symbol = ""; // if (row.expanded) // symbol = "\xe2\x96\xbd "; @@ -1995,14 +1986,14 @@ // symbol = "\xe2\x96\xb7 "; // window.PutCString (symbol); - // The ACS_DARROW and ACS_RARROW don't look very nice they are just a - // 'v' or '>' character... + // The ACS_DARROW and ACS_RARROW don't look very nice they are just a 'v' + // or '>' character... // if (expanded) // window.PutChar (ACS_DARROW); // else // window.PutChar (ACS_RARROW); - // Since we can't find any good looking right arrow/down arrow - // symbols, just use a diamond... + // Since we can't find any good looking right arrow/down arrow symbols, + // just use a diamond... window.PutChar(ACS_DIAMOND); window.PutChar(ACS_HLINE); } @@ -2102,9 +2093,8 @@ const bool expanded = IsExpanded(); - // The root item must calculate its children, - // or we must calculate the number of children - // if the item is expanded + // The root item must calculate its children, or we must calculate the + // number of children if the item is expanded if (m_parent == nullptr || expanded) GetNumChildren(); @@ -2137,8 +2127,7 @@ if (m_might_have_children) { // It we can get UTF8 characters to work we should try to use the - // "symbol" - // UTF8 string below + // "symbol" UTF8 string below // const char *symbol = ""; // if (row.expanded) // symbol = "\xe2\x96\xbd "; @@ -2152,8 +2141,8 @@ // window.PutChar (ACS_DARROW); // else // window.PutChar (ACS_RARROW); - // Since we can't find any good looking right arrow/down arrow - // symbols, just use a diamond... + // Since we can't find any good looking right arrow/down arrow symbols, + // just use a diamond... window.PutChar(ACS_DIAMOND); window.PutChar(ACS_HLINE); } @@ -2176,8 +2165,8 @@ if (IsExpanded()) { for (auto &item : m_children) { - // If we displayed all the rows and item.Draw() returns - // false we are done drawing and can exit this for loop + // If we displayed all the rows and item.Draw() returns false we are + // done drawing and can exit this for loop if (!item.Draw(window, first_visible_row, selected_row_idx, row_idx, num_rows_left)) break; @@ -2287,10 +2276,9 @@ m_num_rows = 0; m_root.CalculateRowIndexes(m_num_rows); - // If we unexpanded while having something selected our - // total number of rows is less than the num visible rows, - // then make sure we show all the rows by setting the first - // visible row accordingly. + // If we unexpanded while having something selected our total number of + // rows is less than the num visible rows, then make sure we show all the + // rows by setting the first visible row accordingly. if (m_first_visible_row > 0 && m_num_rows < num_visible_rows) m_first_visible_row = 0; @@ -2696,10 +2684,9 @@ const int num_visible_rows = NumVisibleRows(); const int num_rows = CalculateTotalNumberRows(m_rows); - // If we unexpanded while having something selected our - // total number of rows is less than the num visible rows, - // then make sure we show all the rows by setting the first - // visible row accordingly. + // If we unexpanded while having something selected our total number of + // rows is less than the num visible rows, then make sure we show all the + // rows by setting the first visible row accordingly. if (m_first_visible_row > 0 && num_rows < num_visible_rows) m_first_visible_row = 0; @@ -2715,8 +2702,8 @@ // Get the selected row m_selected_row = GetRowForRowIndex(m_selected_row_idx); - // Keep the cursor on the selected row so the highlight and the cursor - // are always on the same line + // Keep the cursor on the selected row so the highlight and the cursor are + // always on the same line if (m_selected_row) window.MoveCursor(m_selected_row->x, m_selected_row->y); @@ -3128,8 +3115,8 @@ if (process && process->IsAlive()) return true; // Don't do any updating if we are running else { - // Update the values with an empty list if there - // is no process or the process isn't alive anymore + // Update the values with an empty list if there is no process or the + // process isn't alive anymore SetValues(value_list); } } @@ -3393,8 +3380,8 @@ if (num_lines <= num_visible_lines) { done = true; - // If we have all lines visible and don't need scrolling, then any - // key press will cause us to exit + // If we have all lines visible and don't need scrolling, then any key + // press will cause us to exit } else { switch (key) { case KEY_UP: @@ -3607,8 +3594,8 @@ case eMenuID_Process: { // Populate the menu with all of the threads if the process is stopped - // when - // the Process menu gets selected and is about to display its submenu. + // when the Process menu gets selected and is about to display its + // submenu. Menus &submenus = menu.GetSubmenus(); ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext(); @@ -3643,8 +3630,8 @@ nullptr, menu_char, thread_sp->GetID()))); } } else if (submenus.size() > 7) { - // Remove the separator and any other thread submenu items - // that were previously added + // Remove the separator and any other thread submenu items that were + // previously added submenus.erase(submenus.begin() + 7, submenus.end()); } // Since we are adding and removing items we need to recalculate the name @@ -3672,8 +3659,8 @@ registers_bounds.size.width = source_bounds.size.width; registers_window_sp->SetBounds(registers_bounds); } else { - // We have no registers window showing so give the bottom - // area back to the source view + // We have no registers window showing so give the bottom area back + // to the source view source_window_sp->Resize(source_bounds.size.width, source_bounds.size.height + variables_bounds.size.height); @@ -3722,8 +3709,8 @@ registers_window_sp->GetWidth(), variables_bounds.size.height); } else { - // We have no variables window showing so give the bottom - // area back to the source view + // We have no variables window showing so give the bottom area back + // to the source view source_window_sp->Resize(source_bounds.size.width, source_bounds.size.height + registers_window_sp->GetHeight()); @@ -3732,9 +3719,9 @@ } else { Rect new_regs_rect; if (variables_window_sp) { - // We have a variables window, split it into two columns - // where the left hand side will be the variables and the - // right hand side will be the registers + // We have a variables window, split it into two columns where the + // left hand side will be the variables and the right hand side will + // be the registers const Rect variables_bounds = variables_window_sp->GetBounds(); Rect new_vars_rect; variables_bounds.VerticalSplitPercentage(0.50, new_vars_rect, @@ -3946,8 +3933,8 @@ m_selected_line = m_pc_line; if (m_file_sp && m_file_sp->FileSpecMatches(m_sc.line_entry.file)) { - // Same file, nothing to do, we should either have the - // lines or not (source file missing) + // Same file, nothing to do, we should either have the lines or not + // (source file missing) if (m_selected_line >= static_cast(m_first_visible_line)) { if (m_selected_line >= m_first_visible_line + num_visible_lines) m_first_visible_line = m_selected_line - 10; @@ -4628,8 +4615,8 @@ WindowSP menubar_window_sp = main_window_sp->CreateSubWindow("Menubar", menubar_bounds, false); - // Let the menubar get keys if the active window doesn't handle the - // keys that are typed so it can respond to menubar key presses. + // Let the menubar get keys if the active window doesn't handle the keys + // that are typed so it can respond to menubar key presses. menubar_window_sp->SetCanBeActive( false); // Don't let the menubar become the active window menubar_window_sp->SetDelegate(menubar_sp); Index: lldb/trunk/source/Core/Listener.cpp =================================================================== --- lldb/trunk/source/Core/Listener.cpp +++ lldb/trunk/source/Core/Listener.cpp @@ -304,11 +304,9 @@ if (remove) { m_events.erase(pos); - // 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". + // 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(); event_sp->DoOnRemoval(); } @@ -434,8 +432,8 @@ if (!manager_sp) return 0; - // The BroadcasterManager mutex must be locked before m_broadcasters_mutex - // to avoid violating the lock hierarchy (manager before broadcasters). + // The BroadcasterManager mutex must be locked before m_broadcasters_mutex to + // avoid violating the lock hierarchy (manager before broadcasters). std::lock_guard manager_guard( manager_sp->m_manager_mutex); std::lock_guard guard(m_broadcasters_mutex); Index: lldb/trunk/source/Core/Mangled.cpp =================================================================== --- lldb/trunk/source/Core/Mangled.cpp +++ lldb/trunk/source/Core/Mangled.cpp @@ -90,10 +90,8 @@ g_most_recent_mangled_to_name_sans_args; // Need to have the mangled & demangled names we're currently examining as - // statics - // so we can return a const ref to them at the end of the func if we don't - // have - // anything better. + // statics so we can return a const ref to them at the end of the func if we + // don't have anything better. static ConstString g_last_mangled; static ConstString g_last_demangled; @@ -142,8 +140,8 @@ Mangled::Mangled() : m_mangled(), m_demangled() {} //---------------------------------------------------------------------- -// Constructor with an optional string and a boolean indicating if it is -// the mangled version. +// Constructor with an optional string and a boolean indicating if it is the +// mangled version. //---------------------------------------------------------------------- Mangled::Mangled(const ConstString &s, bool mangled) : m_mangled(), m_demangled() { @@ -172,8 +170,8 @@ Mangled::~Mangled() {} //---------------------------------------------------------------------- -// Convert to pointer operator. This allows code to check any Mangled -// objects to see if they contain anything valid using code such as: +// Convert to pointer operator. This allows code to check any Mangled objects +// to see if they contain anything valid using code such as: // // Mangled mangled(...); // if (mangled) @@ -184,8 +182,8 @@ } //---------------------------------------------------------------------- -// Logical NOT operator. This allows code to check any Mangled -// objects to see if they are invalid using code such as: +// Logical NOT operator. This allows code to check any Mangled objects to see +// if they are invalid using code such as: // // Mangled mangled(...); // if (!file_spec) @@ -211,9 +209,8 @@ } //---------------------------------------------------------------------- -// Set the string value in this objects. If "mangled" is true, then -// the mangled named is set with the new value in "s", else the -// demangled name is set. +// Set the string value in this objects. If "mangled" is true, then the mangled +// named is set with the new value in "s", else the demangled name is set. //---------------------------------------------------------------------- void Mangled::SetValue(const ConstString &s, bool mangled) { if (s) { @@ -246,16 +243,15 @@ } //---------------------------------------------------------------------- -// Generate the demangled name on demand using this accessor. Code in -// this class will need to use this accessor if it wishes to decode -// the demangled name. The result is cached and will be kept until a -// new string value is supplied to this object, or until the end of the -// object's lifetime. +// Generate the demangled name on demand using this accessor. Code in this +// class will need to use this accessor if it wishes to decode the demangled +// name. The result is cached and will be kept until a new string value is +// supplied to this object, or until the end of the object's lifetime. //---------------------------------------------------------------------- const ConstString & Mangled::GetDemangledName(lldb::LanguageType language) const { - // Check to make sure we have a valid mangled name and that we - // haven't already decoded our mangled name. + // Check to make sure we have a valid mangled name and that we haven't + // already decoded our mangled name. if (m_mangled && !m_demangled) { // We need to generate and cache the demangled name. static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); @@ -302,9 +298,8 @@ #ifdef LLDB_USE_BUILTIN_DEMANGLER if (log) log->Printf("demangle itanium: %s", mangled_name); - // Try to use the fast-path demangler first for the - // performance win, falling back to the full demangler only - // when necessary + // Try to use the fast-path demangler first for the performance win, + // falling back to the full demangler only when necessary demangled_name = FastDemangle(mangled_name, m_mangled.GetLength()); if (!demangled_name) demangled_name = @@ -331,8 +326,8 @@ } } if (!m_demangled) { - // Set the demangled string to the empty string to indicate we - // tried to parse it once and failed. + // Set the demangled string to the empty string to indicate we tried to + // parse it once and failed. m_demangled.SetCString(""); } } @@ -370,8 +365,8 @@ return get_demangled_name_without_arguments(m_mangled, demangled); } if (preference == ePreferDemangled) { - // Call the accessor to make sure we get a demangled name in case - // it hasn't been demangled yet... + // Call the accessor to make sure we get a demangled name in case it hasn't + // been demangled yet... if (demangled) return demangled; return m_mangled; @@ -380,8 +375,8 @@ } //---------------------------------------------------------------------- -// Dump a Mangled object to stream "s". We don't force our -// demangled name to be computed currently (we don't use the accessor). +// Dump a Mangled object to stream "s". We don't force our demangled name to be +// computed currently (we don't use the accessor). //---------------------------------------------------------------------- void Mangled::Dump(Stream *s) const { if (m_mangled) { @@ -394,8 +389,8 @@ } //---------------------------------------------------------------------- -// Dumps a debug version of this string with extra object and state -// information to stream "s". +// Dumps a debug version of this string with extra object and state information +// to stream "s". //---------------------------------------------------------------------- void Mangled::DumpDebug(Stream *s) const { s->Printf("%*p: Mangled mangled = ", static_cast(sizeof(void *) * 2), @@ -406,21 +401,21 @@ } //---------------------------------------------------------------------- -// Return the size in byte that this object takes in memory. The size -// includes the size of the objects it owns, and not the strings that -// it references because they are shared strings. +// Return the size in byte that this object takes in memory. The size includes +// the size of the objects it owns, and not the strings that it references +// because they are shared strings. //---------------------------------------------------------------------- size_t Mangled::MemorySize() const { return m_mangled.MemorySize() + m_demangled.MemorySize(); } //---------------------------------------------------------------------- -// We "guess" the language because we can't determine a symbol's language -// from it's name. For example, a Pascal symbol can be mangled using the -// C++ Itanium scheme, and defined in a compilation unit within the same -// module as other C++ units. In addition, different targets could have -// different ways of mangling names from a given language, likewise the -// compilation units within those targets. +// We "guess" the language because we can't determine a symbol's language from +// it's name. For example, a Pascal symbol can be mangled using the C++ +// Itanium scheme, and defined in a compilation unit within the same module as +// other C++ units. In addition, different targets could have different ways +// of mangling names from a given language, likewise the compilation units +// within those targets. //---------------------------------------------------------------------- lldb::LanguageType Mangled::GuessLanguage() const { ConstString mangled = GetMangledName(); @@ -433,7 +428,7 @@ return lldb::eLanguageTypeObjC; } } else { - // ObjC names aren't really mangled, so they won't necessarily be in the + // ObjC names aren't really mangled, so they won't necessarily be in the // mangled name slot. ConstString demangled_name = GetDemangledName(lldb::eLanguageTypeUnknown); if (demangled_name Index: lldb/trunk/source/Core/Module.cpp =================================================================== --- lldb/trunk/source/Core/Module.cpp +++ lldb/trunk/source/Core/Module.cpp @@ -79,21 +79,17 @@ using namespace lldb; using namespace lldb_private; -// Shared pointers to modules track module lifetimes in -// targets and in the global module, but this collection -// will track all module objects that are still alive +// Shared pointers to modules track module lifetimes in targets and in the +// global module, but this collection will track all module objects that are +// still alive typedef std::vector ModuleCollection; static ModuleCollection &GetModuleCollection() { // This module collection needs to live past any module, so we could either - // make it a - // shared pointer in each module or just leak is. Since it is only an empty - // vector by - // the time all the modules have gone away, we just leak it for now. If we - // decide this - // is a big problem we can introduce a Finalize method that will tear - // everything down in - // a predictable order. + // make it a shared pointer in each module or just leak is. Since it is only + // an empty vector by the time all the modules have gone away, we just leak + // it for now. If we decide this is a big problem we can introduce a + // Finalize method that will tear everything down in a predictable order. static ModuleCollection *g_module_collection = nullptr; if (g_module_collection == nullptr) @@ -104,9 +100,9 @@ std::recursive_mutex &Module::GetAllocationModuleCollectionMutex() { // NOTE: The mutex below must be leaked since the global module list in - // the ModuleList class will get torn at some point, and we can't know - // if it will tear itself down before the "g_module_collection_mutex" below - // will. So we leak a Mutex object below to safeguard against that + // the ModuleList class will get torn at some point, and we can't know if it + // will tear itself down before the "g_module_collection_mutex" below will. + // So we leak a Mutex object below to safeguard against that static std::recursive_mutex *g_module_collection_mutex = nullptr; if (g_module_collection_mutex == nullptr) @@ -151,8 +147,8 @@ : 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 + // 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) @@ -160,9 +156,8 @@ // 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 + // "/usr/lib/dyld" with UUID XXX, but we might have a local version of + // "/usr/lib/dyld" that has // UUID YYY and we don't want those to match. If they don't match, just don't // fill any ivars in so we don't accidentally grab the wrong file later since // they don't match... @@ -177,8 +172,8 @@ m_mod_time = FileSystem::GetModificationTime(matching_module_spec.GetFileSpec()); - // Copy the architecture from the actual spec if we got one back, else use the - // one that was specified + // Copy the architecture from the actual spec if we got one back, else use + // the one that was specified if (matching_module_spec.GetArchitecture().IsValid()) m_arch = matching_module_spec.GetArchitecture(); else if (module_spec.GetArchitecture().IsValid()) @@ -210,9 +205,9 @@ else m_object_name = module_spec.GetObjectName(); - // Always trust the object offset (file offset) and object modification - // time (for mod time in a BSD static archive) of from the matching - // module specification + // Always trust the object offset (file offset) and object modification time + // (for mod time in a BSD static archive) of from the matching module + // specification m_object_offset = matching_module_spec.GetObjectOffset(); m_object_mod_time = matching_module_spec.GetObjectModificationTime(); } @@ -253,8 +248,8 @@ } Module::~Module() { - // Lock our module down while we tear everything down to make sure - // we don't get any access to the module while it is being destroyed + // Lock our module down while we tear everything down to make sure we don't + // get any access to the module while it is being destroyed std::lock_guard guard(m_mutex); // Scope for locker below... { @@ -308,9 +303,8 @@ m_object_name.SetString(s.GetString()); // Once we get the object file, update our module with the object - // file's - // architecture since it might differ in vendor/os if some parts were - // unknown. + // file's architecture since it might differ in vendor/os if some + // parts were unknown. m_objfile_sp->GetArchitecture(m_arch); } else { error.SetErrorString("unable to find suitable object file plug-in"); @@ -441,8 +435,8 @@ // Make sure the section matches this module before we try and match anything if (section_sp && section_sp->GetModule().get() == this) { - // If the section offset based address resolved itself, then this - // is the right module. + // If the section offset based address resolved itself, then this is the + // right module. sc.module_sp = shared_from_this(); resolved_flags |= eSymbolContextModule; @@ -450,8 +444,8 @@ if (!sym_vendor) return resolved_flags; - // Resolve the compile unit, function, block, line table or line - // entry if requested. + // Resolve the compile unit, function, block, line table or line entry if + // requested. if (resolve_scope & eSymbolContextCompUnit || resolve_scope & eSymbolContextFunction || resolve_scope & eSymbolContextBlock || @@ -461,8 +455,8 @@ sym_vendor->ResolveSymbolContext(so_addr, resolve_scope, sc); } - // Resolve the symbol if requested, but don't re-look it up if we've already - // found it. + // Resolve the symbol if requested, but don't re-look it up if we've + // already found it. if (resolve_scope & eSymbolContextSymbol && !(resolved_flags & eSymbolContextSymbol)) { Symtab *symtab = sym_vendor->GetSymtab(); @@ -491,12 +485,11 @@ if (sc.symbol) { if (sc.symbol->IsSynthetic()) { - // We have a synthetic symbol so lets check if the object file - // from the symbol file in the symbol vendor is different than - // the object file for the module, and if so search its symbol - // table to see if we can come up with a better symbol. For example - // dSYM files on MacOSX have an unstripped symbol table inside of - // them. + // We have a synthetic symbol so lets check if the object file from + // the symbol file in the symbol vendor is different than the + // object file for the module, and if so search its symbol table to + // see if we can come up with a better symbol. For example dSYM + // files on MacOSX have an unstripped symbol table inside of them. ObjectFile *symtab_objfile = symtab->GetObjectFile(); if (symtab_objfile && symtab_objfile->IsStripped()) { SymbolFile *symfile = sym_vendor->GetSymbolFile(); @@ -522,10 +515,8 @@ } // For function symbols, so_addr may be off by one. This is a convention - // consistent - // with FDE row indices in eh_frame sections, but requires extra logic here - // to permit - // symbol lookup for disassembly and unwind. + // consistent with FDE row indices in eh_frame sections, but requires extra + // logic here to permit symbol lookup for disassembly and unwind. if (resolve_scope & eSymbolContextSymbol && !(resolved_flags & eSymbolContextSymbol) && resolve_tail_call_address && so_addr.IsSectionOffset()) { @@ -542,10 +533,9 @@ if (addr_range.GetBaseAddress().GetSection() == so_addr.GetSection()) { // If the requested address is one past the address range of a - // function (i.e. a tail call), - // or the decremented address is the start of a function (i.e. some - // forms of trampoline), - // indicate that the symbol has been resolved. + // function (i.e. a tail call), or the decremented address is the + // start of a function (i.e. some forms of trampoline), indicate + // that the symbol has been resolved. if (so_addr.GetOffset() == addr_range.GetBaseAddress().GetOffset() || so_addr.GetOffset() == @@ -677,25 +667,22 @@ if (name_type_mask & eFunctionNameTypeMethod || name_type_mask & eFunctionNameTypeBase) { // If they've asked for a CPP method or function name and it can't be - // that, we don't - // even need to search for CPP methods or names. + // that, we don't even need to search for CPP methods or names. CPlusPlusLanguage::MethodName cpp_method(name); if (cpp_method.IsValid()) { basename = cpp_method.GetBasename(); if (!cpp_method.GetQualifiers().empty()) { // There is a "const" or other qualifier following the end of the - // function parens, - // this can't be a eFunctionNameTypeBase + // function parens, this can't be a eFunctionNameTypeBase m_name_type_mask &= ~(eFunctionNameTypeBase); if (m_name_type_mask == eFunctionNameTypeNone) return; } } else { // If the CPP method parser didn't manage to chop this up, try to fill - // in the base name if we can. - // If a::b::c is passed in, we need to just look up "c", and then we'll - // filter the result later. + // in the base name if we can. If a::b::c is passed in, we need to just + // look up "c", and then we'll filter the result later. CPlusPlusLanguage::ExtractContextAndIdentifier(name_cstr, context, basename); } @@ -724,19 +711,15 @@ } if (!basename.empty()) { - // The name supplied was a partial C++ path like "a::count". In this case we - // want to do a - // lookup on the basename "count" and then make sure any matching results - // contain "a::count" - // so that it would match "b::a::count" and "a::count". This is why we set - // "match_name_after_lookup" - // to true + // The name supplied was a partial C++ path like "a::count". In this case + // we want to do a lookup on the basename "count" and then make sure any + // matching results contain "a::count" so that it would match "b::a::count" + // and "a::count". This is why we set "match_name_after_lookup" to true m_lookup_name.SetString(basename); m_match_name_after_lookup = true; } else { // The name is already correct, just use the exact name as supplied, and we - // won't need - // to check if any matches contain "name" + // won't need to check if any matches contain "name" m_lookup_name = name; m_match_name_after_lookup = false; } @@ -770,8 +753,8 @@ while (i < sc_list.GetSize()) { if (!sc_list.GetContextAtIndex(i, sc)) break; - // Make sure the mangled and demangled names don't match before we try - // to pull anything out + // Make sure the mangled and demangled names don't match before we try to + // pull anything out ConstString mangled_name(sc.GetFunctionName(Mangled::ePreferMangled)); ConstString full_name(sc.GetFunctionName()); if (mangled_name != m_name && full_name != m_name) @@ -867,7 +850,8 @@ if (symbols) { symbols->FindFunctions(regex, include_inlines, append, sc_list); - // Now check our symbol table for symbols that are code symbols if requested + // Now check our symbol table for symbols that are code symbols if + // requested if (include_symbols) { Symtab *symtab = symbols->GetSymtab(); if (symtab) { @@ -882,7 +866,8 @@ size_t num_functions_added_to_sc_list = end_functions_added_index - start_size; if (num_functions_added_to_sc_list == 0) { - // No functions were added, just symbols, so we can just append them + // No functions were added, just symbols, so we can just append + // them for (size_t i = 0; i < num_matches; ++i) { sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]); SymbolType sym_type = sc.symbol->GetType(); @@ -1021,8 +1006,7 @@ // basename if (type_class != eTypeClassAny) { // The "type_name_cstr" will have been modified if we have a valid type - // class - // prefix (like "struct", "class", "union", "typedef" etc). + // class prefix (like "struct", "class", "union", "typedef" etc). FindTypes_Impl(sc, ConstString(type_basename), nullptr, append, max_matches, searched_symbol_files, typesmap); typesmap.RemoveMismatchedTypes(type_class); @@ -1057,8 +1041,8 @@ void Module::SetFileSpecAndObjectName(const FileSpec &file, const ConstString &object_name) { - // Container objects whose paths do not specify a file directly can call - // this function to correct the file and object names. + // Container objects whose paths do not specify a file directly can call this + // function to correct the file and object names. m_file = file; m_mod_time = FileSystem::GetModificationTime(file); m_object_name = object_name; @@ -1258,12 +1242,10 @@ file_size - m_object_offset, data_sp, data_offset); if (m_objfile_sp) { // Once we get the object file, update our module with the object - // file's - // architecture since it might differ in vendor/os if some parts were - // unknown. But since the matching arch might already be more - // specific - // than the generic COFF architecture, only merge in those values that - // overwrite unspecified unknown values. + // file's architecture since it might differ in vendor/os if some + // parts were unknown. But since the matching arch might already be + // more specific than the generic COFF architecture, only merge in + // those values that overwrite unspecified unknown values. ArchSpec new_arch; m_objfile_sp->GetArchitecture(new_arch); m_arch.MergeFrom(new_arch); @@ -1427,9 +1409,8 @@ if (section_list && symbol_file) { ObjectFile *obj_file = symbol_file->GetObjectFile(); // Make sure we have an object file and that the symbol vendor's objfile - // isn't - // the same as the module's objfile before we remove any sections for - // it... + // isn't the same as the module's objfile before we remove any sections + // for it... if (obj_file) { // Check to make sure we aren't trying to specify the file we already // have @@ -1444,8 +1425,7 @@ obj_file->ClearSymtab(); // The symbol file might be a directory bundle ("/tmp/a.out.dSYM") - // instead - // of a full path to the symbol file within the bundle + // instead of a full path to the symbol file within the bundle // ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to // check this @@ -1472,8 +1452,7 @@ } } // Keep all old symbol files around in case there are any lingering type - // references in - // any SBValue objects that might have been handed out. + // references in any SBValue objects that might have been handed out. m_old_symfiles.push_back(std::move(m_symfile_ap)); } m_symfile_spec = file; @@ -1658,10 +1637,9 @@ ModuleSP Module::CreateJITModule(const lldb::ObjectFileJITDelegateSP &delegate_sp) { if (delegate_sp) { - // Must create a module and place it into a shared pointer before - // we can create an object file since it has a std::weak_ptr back - // to the module, so we need to control the creation carefully in - // this static function + // Must create a module and place it into a shared pointer before we can + // create an object file since it has a std::weak_ptr back to the module, + // so we need to control the creation carefully in this static function ModuleSP module_sp(new Module()); module_sp->m_objfile_sp = std::make_shared(module_sp, delegate_sp); Index: lldb/trunk/source/Core/ModuleList.cpp =================================================================== --- lldb/trunk/source/Core/ModuleList.cpp +++ lldb/trunk/source/Core/ModuleList.cpp @@ -132,8 +132,8 @@ // in thread A: | in thread B: // x = y; | y = x; // - // This establishes correct(same) lock taking order and thus - // avoids priority inversion. + // This establishes correct(same) lock taking order and thus avoids + // priority inversion. if (uintptr_t(this) > uintptr_t(&rhs)) { std::lock_guard lhs_guard(m_modules_mutex); std::lock_guard rhs_guard(rhs.m_modules_mutex); @@ -545,8 +545,8 @@ size_t total_matches = 0; collection::const_iterator pos, end = m_modules.end(); if (sc.module_sp) { - // The symbol context "sc" contains a module so we want to search that - // one first if it is in our list... + // The symbol context "sc" contains a module so we want to search that one + // first if it is in our list... for (pos = m_modules.begin(); pos != end; ++pos) { if (sc.module_sp.get() == (*pos).get()) { total_matches += @@ -563,8 +563,8 @@ SymbolContext world_sc; for (pos = m_modules.begin(); pos != end; ++pos) { // Search the module if the module is not equal to the one in the symbol - // context "sc". If "sc" contains a empty module shared pointer, then - // the comparison will always be true (valid_module_ptr != nullptr). + // context "sc". If "sc" contains a empty module shared pointer, then the + // comparison will always be true (valid_module_ptr != nullptr). if (sc.module_sp.get() != (*pos).get()) total_matches += (*pos)->FindTypes(world_sc, name, name_is_fully_qualified, @@ -791,8 +791,8 @@ const ArchSpec &arch = module_spec.GetArchitecture(); // Make sure no one else can try and get or create a module while this - // function is actively working on it by doing an extra lock on the - // global mutex list. + // function is actively working on it by doing an extra lock on the global + // mutex list. if (!always_create) { ModuleList matching_module_list; const size_t num_matching_modules = @@ -815,8 +815,8 @@ shared_module_list.Remove(module_sp); module_sp.reset(); } else { - // The module matches and the module was not modified from - // when it was last loaded. + // The module matches and the module was not modified from when it + // was last loaded. return error; } } @@ -827,12 +827,12 @@ return error; module_sp.reset(new Module(module_spec)); - // Make sure there are a module and an object file since we can specify - // a valid file path with an architecture that might not be in that file. - // By getting the object file we can guarantee that the architecture matches + // Make sure there are a module and an object file since we can specify a + // valid file path with an architecture that might not be in that file. By + // getting the object file we can guarantee that the architecture matches if (module_sp->GetObjectFile()) { - // If we get in here we got the correct arch, now we just need - // to verify the UUID if one was given + // If we get in here we got the correct arch, now we just need to verify + // the UUID if one was given if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) { module_sp.reset(); } else { @@ -871,8 +871,8 @@ resolved_module_spec.GetFileSpec() = search_path_spec; module_sp.reset(new Module(resolved_module_spec)); if (module_sp->GetObjectFile()) { - // If we get in here we got the correct arch, now we just need - // to verify the UUID if one was given + // If we get in here we got the correct arch, now we just need to + // verify the UUID if one was given if (uuid_ptr && *uuid_ptr != module_sp->GetUUID()) { module_sp.reset(); } else { @@ -897,8 +897,8 @@ // we now have to use more extreme measures to try and find the appropriate // module. - // Fixup the incoming path in case the path points to a valid file, yet - // the arch or UUID (if one was passed in) don't match. + // Fixup the incoming path in case the path points to a valid file, yet the + // arch or UUID (if one was passed in) don't match. ModuleSpec located_binary_modulespec = Symbols::LocateExecutableObjectFile(module_spec); @@ -935,8 +935,8 @@ } // Make sure no one else can try and get or create a module while this - // function is actively working on it by doing an extra lock on the - // global mutex list. + // function is actively working on it by doing an extra lock on the global + // mutex list. ModuleSpec platform_module_spec(module_spec); platform_module_spec.GetFileSpec() = located_binary_modulespec.GetFileSpec(); @@ -967,8 +967,8 @@ if (!module_sp) { module_sp.reset(new Module(platform_module_spec)); - // Make sure there are a module and an object file since we can specify - // a valid file path with an architecture that might not be in that file. + // Make sure there are a module and an object file since we can specify a + // valid file path with an architecture that might not be in that file. // By getting the object file we can guarantee that the architecture // matches if (module_sp && module_sp->GetObjectFile()) { Index: lldb/trunk/source/Core/Opcode.cpp =================================================================== --- lldb/trunk/source/Core/Opcode.cpp +++ lldb/trunk/source/Core/Opcode.cpp @@ -52,8 +52,8 @@ break; } - // Add spaces to make sure bytes dispay comes out even in case opcodes - // aren't all the same size + // Add spaces to make sure bytes dispay comes out even in case opcodes aren't + // all the same size if (static_cast(bytes_written) < min_byte_width) bytes_written = s->Printf("%*s", min_byte_width - bytes_written, ""); return bytes_written; Index: lldb/trunk/source/Core/PluginManager.cpp =================================================================== --- lldb/trunk/source/Core/PluginManager.cpp +++ lldb/trunk/source/Core/PluginManager.cpp @@ -96,8 +96,8 @@ Status error; namespace fs = llvm::sys::fs; - // If we have a regular file, a symbolic link or unknown file type, try - // and process the file. We must handle unknown as sometimes the directory + // If we have a regular file, a symbolic link or unknown file type, try and + // process the file. We must handle unknown as sometimes the directory // enumeration might be enumerating a file system that doesn't have correct // file type information. if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || @@ -128,17 +128,14 @@ plugin_info.library.getAddressOfSymbol("LLDBPluginTerminate")); } else { // The initialize function returned FALSE which means the plug-in - // might not be - // compatible, or might be too new or too old, or might not want to - // run on this - // machine. Set it to a default-constructed instance to invalidate - // it. + // might not be compatible, or might be too new or too old, or might + // not want to run on this machine. Set it to a default-constructed + // instance to invalidate it. plugin_info = PluginInfo(); } - // Regardless of success or failure, cache the plug-in load - // in our plug-in info so we don't try to load it again and - // again. + // Regardless of success or failure, cache the plug-in load in our + // plug-in info so we don't try to load it again and again. SetPluginInfo(plugin_file_spec, plugin_info); return FileSpec::eEnumerateDirectoryResultNext; @@ -148,9 +145,9 @@ if (ft == fs::file_type::directory_file || ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { - // Try and recurse into anything that a directory or symbolic link. - // We must also do this for unknown as sometimes the directory enumeration - // might be enumerating a file system that doesn't have correct file type + // Try and recurse into anything that a directory or symbolic link. We must + // also do this for unknown as sometimes the directory enumeration might be + // enumerating a file system that doesn't have correct file type // information. return FileSpec::eEnumerateDirectoryResultEnter; } @@ -187,8 +184,8 @@ PluginTerminateMap::const_iterator pos, end = plugin_map.end(); for (pos = plugin_map.begin(); pos != end; ++pos) { - // Call the plug-in "void LLDBPluginTerminate (void)" function if there - // is one (if the symbol was not nullptr). + // Call the plug-in "void LLDBPluginTerminate (void)" function if there is + // one (if the symbol was not nullptr). if (pos->second.library.isValid()) { if (pos->second.plugin_term_callback) pos->second.plugin_term_callback(); @@ -2397,8 +2394,8 @@ } // This is deprecated way to register plugin specific settings. e.g. -// ".plugin..SETTINGNAME" -// and Platform generic settings would be under "platform.SETTINGNAME". +// ".plugin..SETTINGNAME" and Platform +// generic settings would be under "platform.SETTINGNAME". static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle( Debugger &debugger, const ConstString &plugin_type_name, const ConstString &plugin_type_desc, bool can_create) { Index: lldb/trunk/source/Core/RegisterValue.cpp =================================================================== --- lldb/trunk/source/Core/RegisterValue.cpp +++ lldb/trunk/source/Core/RegisterValue.cpp @@ -41,8 +41,8 @@ DataExtractor data; if (GetData(data)) { bool name_printed = false; - // For simplicity, alignment of the register name printing applies only - // in the most common case where: + // For simplicity, alignment of the register name printing applies only in + // the most common case where: // // prefix_with_name^prefix_with_alt_name is true // @@ -375,9 +375,9 @@ std::vector bytes; unsigned byte = 0; - // Using radix auto-sensing by passing 0 as the radix. - // Keep on processing the vector elements as long as the parsing succeeds and - // the vector size is < byte_size. + // Using radix auto-sensing by passing 0 as the radix. Keep on processing the + // vector elements as long as the parsing succeeds and the vector size is < + // byte_size. while (!car.getAsInteger(0, byte) && bytes.size() < byte_size) { bytes.push_back(byte); std::tie(car, cdr) = cdr.split(Sep); @@ -812,10 +812,9 @@ void RegisterValue::SetBytes(const void *bytes, size_t length, lldb::ByteOrder byte_order) { - // If this assertion fires off we need to increase the size of - // buffer.bytes, or make it something that is allocated on - // the heap. Since the data buffer is in a union, we can't make it - // a collection class like SmallVector... + // If this assertion fires off we need to increase the size of buffer.bytes, + // or make it something that is allocated on the heap. Since the data buffer + // is in a union, we can't make it a collection class like SmallVector... if (bytes && length > 0) { assert(length <= sizeof(buffer.bytes) && "Storing too many bytes in a RegisterValue."); Index: lldb/trunk/source/Core/Scalar.cpp =================================================================== --- lldb/trunk/source/Core/Scalar.cpp +++ lldb/trunk/source/Core/Scalar.cpp @@ -25,8 +25,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Promote to max type currently follows the ANSI C rule for type -// promotion in expressions. +// Promote to max type currently follows the ANSI C rule for type promotion in +// expressions. //---------------------------------------------------------------------- static Scalar::Type PromoteToMaxType( const Scalar &lhs, // The const left hand side object @@ -41,10 +41,9 @@ // lhs/rhs will get promoted) ) { Scalar result; - // Initialize the promoted values for both the right and left hand side values - // to be the objects themselves. If no promotion is needed (both right and - // left - // have the same type), then the temp_value will not get used. + // Initialize the promoted values for both the right and left hand side + // values to be the objects themselves. If no promotion is needed (both right + // and left have the same type), then the temp_value will not get used. promoted_lhs_ptr = &lhs; promoted_rhs_ptr = &rhs; // Extract the types of both the right and left hand side values @@ -128,14 +127,13 @@ if (limit_byte_size < byte_size) { if (endian::InlHostByteOrder() == eByteOrderLittle) { - // On little endian systems if we want fewer bytes from the - // current type we just specify fewer bytes since the LSByte - // is first... + // On little endian systems if we want fewer bytes from the current + // type we just specify fewer bytes since the LSByte is first... byte_size = limit_byte_size; } else if (endian::InlHostByteOrder() == eByteOrderBig) { - // On big endian systems if we want fewer bytes from the - // current type have to advance our initial byte pointer and - // trim down the number of bytes since the MSByte is first + // On big endian systems if we want fewer bytes from the current type + // have to advance our initial byte pointer and trim down the number of + // bytes since the MSByte is first bytes += byte_size - limit_byte_size; byte_size = limit_byte_size; } @@ -164,9 +162,8 @@ case e_slonglong: case e_ulonglong: bytes = reinterpret_cast(m_integer.getRawData()); - // getRawData always returns a pointer to an uint64_t. If we have a smaller - // type, - // we need to update the pointer on big-endian systems. + // getRawData always returns a pointer to an uint64_t. If we have a + // smaller type, we need to update the pointer on big-endian systems. if (endian::InlHostByteOrder() == eByteOrderBig) { size_t byte_size = m_integer.getBitWidth() / 8; if (byte_size < 8) @@ -2065,8 +2062,7 @@ } } // For division only, the only way it should make it here is if a promotion - // failed, - // or if we are trying to do a divide by zero. + // failed, or if we are trying to do a divide by zero. result.m_type = Scalar::e_void; return result; } Index: lldb/trunk/source/Core/Section.cpp =================================================================== --- lldb/trunk/source/Core/Section.cpp +++ lldb/trunk/source/Core/Section.cpp @@ -177,9 +177,9 @@ addr_t Section::GetFileAddress() const { SectionSP parent_sp(GetParent()); if (parent_sp) { - // This section has a parent which means m_file_addr is an offset into - // the parent section, so the file address for this section is the file - // address of the parent plus the offset + // This section has a parent which means m_file_addr is an offset into the + // parent section, so the file address for this section is the file address + // of the parent plus the offset return parent_sp->GetFileAddress() + m_file_addr; } // This section has no parent, so m_file_addr is the file base address @@ -558,10 +558,8 @@ Section *sect = sect_iter->get(); if (sect->ContainsFileAddress(vm_addr)) { // The file address is in this section. We need to make sure one of our - // child - // sections doesn't contain this address as well as obeying the depth - // limit - // that was passed in. + // child sections doesn't contain this address as well as obeying the + // depth limit that was passed in. if (depth > 0) sect_sp = sect->GetChildren().FindSectionContainingFileAddress( vm_addr, depth - 1); Index: lldb/trunk/source/Core/SourceManager.cpp =================================================================== --- lldb/trunk/source/Core/SourceManager.cpp +++ lldb/trunk/source/Core/SourceManager.cpp @@ -109,8 +109,8 @@ if (!debugger_sp) return false; - // We don't use ANSI stop column formatting if the debugger doesn't think - // it should be using color. + // We don't use ANSI stop column formatting if the debugger doesn't think it + // should be using color. if (!debugger_sp->GetUseColor()) return false; @@ -128,8 +128,8 @@ if (!debugger_sp) return false; - // If we're asked to show the first available of ANSI or caret, then - // we do show the caret when ANSI is not available. + // If we're asked to show the first available of ANSI or caret, then we do + // show the caret when ANSI is not available. const auto value = debugger_sp->GetStopShowColumn(); if ((value == eStopShowColumnAnsiOrCaret) && !debugger_sp->GetUseColor()) return true; @@ -255,9 +255,9 @@ if (m_last_line > 0) { if (reverse) { - // If this is the first time we've done a reverse, then back up one more - // time so we end - // up showing the chunk before the last one we've shown: + // If this is the first time we've done a reverse, then back up one + // more time so we end up showing the chunk before the last one we've + // shown: if (m_last_line > m_last_count) m_last_line -= m_last_count; else @@ -299,10 +299,9 @@ if (target_sp) { // If nobody has set the default file and line then try here. If there's - // no executable, then we - // will try again later when there is one. Otherwise, if we can't find it - // we won't look again, - // somebody will have to set it (for instance when we stop somewhere...) + // no executable, then we will try again later when there is one. + // Otherwise, if we can't find it we won't look again, somebody will have + // to set it (for instance when we stop somewhere...) Module *executable_ptr = target_sp->GetExecutableModulePointer(); if (executable_ptr) { SymbolContextList sc_list; @@ -410,9 +409,7 @@ FileSpec new_file_spec; // Check target specific source remappings first, then fall back to // modules objects can have individual path remappings that were - // detected - // when the debug info for a module was found. - // then + // detected when the debug info for a module was found. then if (target->GetSourcePathMap().FindFile(m_file_spec, new_file_spec) || target->GetImages().FindSourceFile(m_file_spec, new_file_spec)) { m_file_spec = new_file_spec; @@ -538,8 +535,8 @@ if (column && (column < count)) { auto debugger_sp = m_debugger_wp.lock(); if (should_show_stop_column_with_ansi(debugger_sp) && debugger_sp) { - // Check if we have any ANSI codes with which to mark this column. - // If not, no need to do this work. + // Check if we have any ANSI codes with which to mark this column. If + // not, no need to do this work. auto ansi_prefix_entry = debugger_sp->GetStopShowColumnAnsiPrefix(); auto ansi_suffix_entry = debugger_sp->GetStopShowColumnAnsiSuffix(); Index: lldb/trunk/source/Core/Value.cpp =================================================================== --- lldb/trunk/source/Core/Value.cpp +++ lldb/trunk/source/Core/Value.cpp @@ -365,11 +365,10 @@ if (process == NULL || !process->IsAlive()) { Target *target = exe_ctx->GetTargetPtr(); if (target) { - // Allow expressions to run and evaluate things when the target - // has memory sections loaded. This allows you to use "target modules - // load" - // to load your executable and any shared libraries, then execute - // commands where you can look at types in data sections. + // Allow expressions to run and evaluate things when the target has + // memory sections loaded. This allows you to use "target modules + // load" to load your executable and any shared libraries, then + // execute commands where you can look at types in data sections. const SectionLoadList &target_sections = target->GetSectionLoadList(); if (!target_sections.IsEmpty()) { address = m_value.ULongLong(LLDB_INVALID_ADDRESS); @@ -406,8 +405,8 @@ error.SetErrorString("invalid file address"); } else { if (module == NULL) { - // The only thing we can currently lock down to a module so that - // we can resolve a file address, is a variable. + // The only thing we can currently lock down to a module so that we + // can resolve a file address, is a variable. Variable *variable = GetVariable(); if (variable) { SymbolContext var_sc; @@ -541,12 +540,11 @@ } else if ((address_type == eAddressTypeLoad) || (address_type == eAddressTypeFile)) { if (file_so_addr.IsValid()) { - // We have a file address that we were able to translate into a - // section offset address so we might be able to read this from - // the object files if we don't have a live process. Lets always - // try and read from the process if we have one though since we - // want to read the actual value by setting "prefer_file_cache" - // to false. + // We have a file address that we were able to translate into a section + // offset address so we might be able to read this from the object + // files if we don't have a live process. Lets always try and read from + // the process if we have one though since we want to read the actual + // value by setting "prefer_file_cache" to false. const bool prefer_file_cache = false; if (exe_ctx->GetTargetRef().ReadMemory(file_so_addr, prefer_file_cache, dst, byte_size, @@ -555,10 +553,10 @@ "read memory from 0x%" PRIx64 " failed", (uint64_t)address); } } else { - // The execution context might have a NULL process, but it - // might have a valid process in the exe_ctx->target, so use - // the ExecutionContext::GetProcess accessor to ensure we - // get the process if there is one. + // The execution context might have a NULL process, but it might have a + // valid process in the exe_ctx->target, so use the + // ExecutionContext::GetProcess accessor to ensure we get the process + // if there is one. Process *process = exe_ctx->GetProcessPtr(); if (process) { Index: lldb/trunk/source/Core/ValueObject.cpp =================================================================== --- lldb/trunk/source/Core/ValueObject.cpp +++ lldb/trunk/source/Core/ValueObject.cpp @@ -146,16 +146,15 @@ if (update_format) did_change_formats = UpdateFormatsIfNeeded(); - // If this is a constant value, then our success is predicated on whether - // we have an error or not + // If this is a constant value, then our success is predicated on whether we + // have an error or not if (GetIsConstant()) { // if you are constant, things might still have changed behind your back // (e.g. you are a frozen object and things have changed deeper than you - // cared to freeze-dry yourself) - // in this case, your value has not changed, but "computed" entries might - // have, so you might now have - // a different summary, or a different object description. clear these so we - // will recompute them + // cared to freeze-dry yourself) in this case, your value has not changed, + // but "computed" entries might have, so you might now have a different + // summary, or a different object description. clear these so we will + // recompute them if (update_format && !did_change_formats) ClearUserVisibleData(eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsDescription); @@ -167,8 +166,8 @@ if (NeedsUpdating()) { m_update_point.SetUpdated(); - // Save the old value using swap to avoid a string copy which - // also will clear our m_value_str + // Save the old value using swap to avoid a string copy which also will + // clear our m_value_str if (m_value_str.empty()) { m_old_value_valid = false; } else { @@ -215,8 +214,8 @@ if (first_update) SetValueDidChange(false); else if (!m_value_did_change && success == false) { - // The value wasn't gotten successfully, so we mark this - // as changed if the value used to be valid and now isn't + // The value wasn't gotten successfully, so we mark this as changed if + // the value used to be valid and now isn't SetValueDidChange(value_was_valid); } else if (need_compare_checksums) { SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0], @@ -261,8 +260,7 @@ void ValueObject::SetNeedsUpdate() { m_update_point.SetNeedsUpdate(); // We have to clear the value string here so ConstResult children will notice - // if their values are - // changed by hand (i.e. with SetValueAsCString). + // if their values are changed by hand (i.e. with SetValueAsCString). ClearUserVisibleData(eClearUserVisibleDataItemsValue); } @@ -556,9 +554,9 @@ ValueObjectSP ValueObject::GetChildMemberWithName(const ConstString &name, bool can_create) { - // when getting a child by name, it could be buried inside some base - // classes (which really aren't part of the expression path), so we - // need a vector of indexes that can get us down to the correct child + // when getting a child by name, it could be buried inside some base classes + // (which really aren't part of the expression path), so we need a vector of + // indexes that can get us down to the correct child ValueObjectSP child_sp; // We may need to update our value if we are dynamic @@ -682,8 +680,8 @@ const TypeSummaryOptions &options) { destination.clear(); - // ideally we would like to bail out if passing NULL, but if we do so - // we end up not providing the summary for function pointers anymore + // ideally we would like to bail out if passing NULL, but if we do so we end + // up not providing the summary for function pointers anymore if (/*summary_ptr == NULL ||*/ m_is_getting_summary) return false; @@ -695,9 +693,8 @@ actual_options.SetLanguage(GetPreferredDisplayLanguage()); // this is a hot path in code and we prefer to avoid setting this string all - // too often also clearing out other - // information that we might care to see in a crash log. might be useful in - // very specific situations though. + // too often also clearing out other information that we might care to see in + // a crash log. might be useful in very specific situations though. /*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s %s. Summary provider's description is %s", GetTypeName().GetCString(), @@ -925,7 +922,8 @@ break; } - // If we have reached this point, then we have successfully changed the value. + // If we have reached this point, then we have successfully changed the + // value. SetNeedsUpdate(); return true; } @@ -1010,9 +1008,9 @@ DataExtractor data; if (cstr_len > 0 && honor_array) { // I am using GetPointeeData() here to abstract the fact that some - // ValueObjects are actually frozen pointers in the host - // but the pointed-to data lives in the debuggee, and GetPointeeData() - // automatically takes care of this + // ValueObjects are actually frozen pointers in the host but the pointed- + // to data lives in the debuggee, and GetPointeeData() automatically + // takes care of this GetPointeeData(data, 0, cstr_len); if ((bytes_read = data.GetByteSize()) > 0) { @@ -1031,9 +1029,9 @@ int cstr_len_displayed = -1; bool capped_cstr = false; // I am using GetPointeeData() here to abstract the fact that some - // ValueObjects are actually frozen pointers in the host - // but the pointed-to data lives in the debuggee, and GetPointeeData() - // automatically takes care of this + // ValueObjects are actually frozen pointers in the host but the pointed- + // to data lives in the debuggee, and GetPointeeData() automatically + // takes care of this while ((bytes_read = GetPointeeData(data, offset, k_max_buf_size)) > 0) { total_bytes_read += bytes_read; const char *cstr = data.PeekCStr(0); @@ -1175,8 +1173,8 @@ format_sp.reset(new TypeFormatImpl_Format(my_format)); if (GetValueAsCString(*format_sp.get(), m_value_str)) { if (!m_value_did_change && m_old_value_valid) { - // The value was gotten successfully, so we consider the - // value as changed if the value string differs + // The value was gotten successfully, so we consider the value as + // changed if the value string differs SetValueDidChange(m_old_value_str != m_value_str); } } @@ -1187,8 +1185,8 @@ return m_value_str.c_str(); } -// if > 8bytes, 0 is returned. this method should mostly be used -// to read address values out of pointers +// if > 8bytes, 0 is returned. this method should mostly be used to read +// address values out of pointers uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) { // If our byte size is zero this is an aggregate type that has children if (CanProvideValue()) { @@ -1224,10 +1222,9 @@ } // if any more "special cases" are added to -// ValueObject::DumpPrintableRepresentation() please keep -// this call up to date by returning true for your new special cases. We will -// eventually move -// to checking this call result before trying to display special cases +// ValueObject::DumpPrintableRepresentation() please keep this call up to date +// by returning true for your new special cases. We will eventually move to +// checking this call result before trying to display special cases bool ValueObject::HasSpecialPrintableRepresentation( ValueObjectRepresentationStyle val_obj_display, Format custom_format) { Flags flags(GetTypeInfo()); @@ -1276,8 +1273,7 @@ if (flags.AnySet(eTypeIsArray | eTypeIsPointer) && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue) { // when being asked to get a printable display an array or pointer type - // directly, - // try to "do the right thing" + // directly, try to "do the right thing" if (IsCStringContainer(true) && (custom_format == eFormatCString || @@ -1309,8 +1305,8 @@ if (custom_format == eFormatEnum) return false; - // this only works for arrays, because I have no way to know when - // the pointed memory ends, and no special \0 end of data marker + // this only works for arrays, because I have no way to know when the + // pointed memory ends, and no special \0 end of data marker if (flags.Test(eTypeIsArray)) { if ((custom_format == eFormatBytes) || (custom_format == eFormatBytesWithASCII)) { @@ -1406,8 +1402,8 @@ llvm::StringRef str; // this is a local stream that we are using to ensure that the data pointed - // to by cstr survives long enough for us to copy it to its destination - it - // is necessary to have this temporary storage area for cases where our + // to by cstr survives long enough for us to copy it to its destination - + // it is necessary to have this temporary storage area for cases where our // desired output is not backed by some other longer-term storage StreamString strm; @@ -1485,9 +1481,9 @@ s.PutCString(""); } - // we should only return false here if we could not do *anything* - // even if we have an error message as output, that's a success - // from our callers' perspective, so return true + // we should only return false here if we could not do *anything* even if + // we have an error message as output, that's a success from our callers' + // perspective, so return true var_success = true; if (custom_format != eFormatInvalid) @@ -1590,9 +1586,8 @@ switch (value_type) { case Value::eValueTypeLoadAddress: { // If it is a load address, then the scalar value is the storage - // location - // of the data, and we have to shove this value down to that load - // location. + // location of the data, and we have to shove this value down to that + // load location. ExecutionContext exe_ctx(GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); if (process) { @@ -1639,7 +1634,8 @@ return false; } - // If we have reached this point, then we have successfully changed the value. + // If we have reached this point, then we have successfully changed the + // value. SetNeedsUpdate(); return true; } @@ -1734,16 +1730,14 @@ return false; } -// This allows you to create an array member using and index -// that doesn't not fall in the normal bounds of the array. -// Many times structure can be defined as: -// struct Collection -// { +// This allows you to create an array member using and index that doesn't not +// fall in the normal bounds of the array. Many times structure can be defined +// as: struct Collection { // uint32_t item_count; // Item item_array[0]; // }; -// The size of the "item_array" is 1, but many times in practice -// there are more items in "item_array". +// The size of the "item_array" is 1, but many times in practice there are more +// items in "item_array". ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index, bool can_create) { @@ -1752,13 +1746,13 @@ char index_str[64]; snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index); ConstString index_const_str(index_str); - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. + // Check if we have already created a synthetic array member in this valid + // object. If we have we will re-use it. synthetic_child_sp = GetSyntheticChild(index_const_str); if (!synthetic_child_sp) { ValueObject *synthetic_child; - // We haven't made a synthetic array member for INDEX yet, so - // lets make one and cache it for any future reference. + // We haven't made a synthetic array member for INDEX yet, so lets make + // one and cache it for any future reference. synthetic_child = CreateChildAtIndex(0, true, index); // Cache the value if we got one back... @@ -1780,8 +1774,8 @@ char index_str[64]; snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to); ConstString index_const_str(index_str); - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. + // Check if we have already created a synthetic array member in this valid + // object. If we have we will re-use it. synthetic_child_sp = GetSyntheticChild(index_const_str); if (!synthetic_child_sp) { uint32_t bit_field_size = to - from + 1; @@ -1789,8 +1783,8 @@ if (GetDataExtractor().GetByteOrder() == eByteOrderBig) bit_field_offset = GetByteSize() * 8 - bit_field_size - bit_field_offset; - // We haven't made a synthetic array member for INDEX yet, so - // lets make one and cache it for any future reference. + // We haven't made a synthetic array member for INDEX yet, so lets make + // one and cache it for any future reference. ValueObjectChild *synthetic_child = new ValueObjectChild( *this, GetCompilerType(), index_const_str, GetByteSize(), 0, bit_field_size, bit_field_offset, false, false, eAddressTypeInvalid, @@ -1820,8 +1814,8 @@ name_const_str.SetCString(name_str); } - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. + // Check if we have already created a synthetic array member in this valid + // object. If we have we will re-use it. synthetic_child_sp = GetSyntheticChild(name_const_str); if (synthetic_child_sp.get()) @@ -1858,8 +1852,8 @@ name_const_str.SetCString(name_str); } - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. + // Check if we have already created a synthetic array member in this valid + // object. If we have we will re-use it. synthetic_child_sp = GetSyntheticChild(name_const_str); if (synthetic_child_sp.get()) @@ -1884,11 +1878,10 @@ return synthetic_child_sp; } -// your expression path needs to have a leading . or -> -// (unless it somehow "looks like" an array, in which case it has -// a leading [ symbol). while the [ is meaningful and should be shown -// to the user, . and -> are just parser design, but by no means -// added information for the user.. strip them off +// your expression path needs to have a leading . or -> (unless it somehow +// "looks like" an array, in which case it has a leading [ symbol). while the [ +// is meaningful and should be shown to the user, . and -> are just parser +// design, but by no means added information for the user.. strip them off static const char *SkipLeadingExpressionPathSeparators(const char *expression) { if (!expression || !expression[0]) return expression; @@ -1904,12 +1897,12 @@ bool can_create) { ValueObjectSP synthetic_child_sp; ConstString name_const_string(expression); - // Check if we have already created a synthetic array member in this - // valid object. If we have we will re-use it. + // Check if we have already created a synthetic array member in this valid + // object. If we have we will re-use it. synthetic_child_sp = GetSyntheticChild(name_const_string); if (!synthetic_child_sp) { - // We haven't made a synthetic array member for expression yet, so - // lets make one and cache it for any future reference. + // We haven't made a synthetic array member for expression yet, so lets + // make one and cache it for any future reference. synthetic_child_sp = GetValueForExpressionPath( expression, NULL, NULL, GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal( @@ -2055,10 +2048,9 @@ void ValueObject::GetExpressionPath(Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat) { // synthetic children do not actually "exist" as part of the hierarchy, and - // sometimes they are consed up in ways - // that don't make sense from an underlying language/API standpoint. So, use a - // special code path here to return - // something that can hopefully be used in expression + // sometimes they are consed up in ways that don't make sense from an + // underlying language/API standpoint. So, use a special code path here to + // return something that can hopefully be used in expression if (m_is_synthetic_children_generated) { UpdateValueIfNeeded(); @@ -2092,11 +2084,10 @@ if (is_deref_of_parent && epformat == eGetExpressionPathFormatDereferencePointers) { // this is the original format of GetExpressionPath() producing code like - // *(a_ptr).memberName, which is entirely - // fine, until you put this into + // *(a_ptr).memberName, which is entirely fine, until you put this into // StackFrame::GetValueForVariableExpressionPath() which prefers to see - // a_ptr->memberName. - // the eHonorPointers mode is meant to produce strings in this latter format + // a_ptr->memberName. the eHonorPointers mode is meant to produce strings + // in this latter format s.PutCString("*("); } @@ -2105,9 +2096,9 @@ if (parent) parent->GetExpressionPath(s, qualify_cxx_base_classes, epformat); - // if we are a deref_of_parent just because we are synthetic array - // members made up to allow ptr[%d] syntax to work in variable - // printing, then add our name ([%d]) to the expression path + // if we are a deref_of_parent just because we are synthetic array members + // made up to allow ptr[%d] syntax to work in variable printing, then add our + // name ([%d]) to the expression path if (m_is_array_item_for_pointer && epformat == eGetExpressionPathFormatHonorPointers) s.PutCString(m_name.AsCString()); @@ -2355,8 +2346,8 @@ } // if we are here and options.m_no_synthetic_children is true, - // child_valobj_sp is going to be a NULL SP, - // so we hit the "else" branch, and return an error + // child_valobj_sp is going to be a NULL SP, so we hit the "else" + // branch, and return an error if (child_valobj_sp.get()) // if it worked, just return { *reason_to_stop = @@ -2424,8 +2415,8 @@ } // if we are here and options.m_no_synthetic_children is true, - // child_valobj_sp is going to be a NULL SP, - // so we hit the "else" branch, and return an error + // child_valobj_sp is going to be a NULL SP, so we hit the "else" + // branch, and return an error if (child_valobj_sp.get()) // if it worked, move on { root = child_valobj_sp; @@ -2506,8 +2497,8 @@ assert(!bracket_expr.empty()); if (!bracket_expr.contains('-')) { - // if no separator, this is of the form [N]. Note that this cannot - // be an unbounded range of the form [], because that case was handled + // if no separator, this is of the form [N]. Note that this cannot be + // an unbounded range of the form [], because that case was handled // above with an unconditional return. unsigned long index = 0; if (bracket_expr.getAsInteger(0, index)) { @@ -2631,8 +2622,8 @@ *final_result = ValueObject::eExpressionPathEndResultTypeInvalid; return nullptr; } - // if we are here, then root itself is a synthetic VO.. should be good - // to go + // if we are here, then root itself is a synthetic VO.. should be + // good to go if (!root) { *reason_to_stop = @@ -3031,20 +3022,17 @@ ValueObject::EvaluationPoint::~EvaluationPoint() {} // This function checks the EvaluationPoint against the current process state. -// If the current -// state matches the evaluation point, or the evaluation point is already -// invalid, then we return -// false, meaning "no change". If the current state is different, we update our -// state, and return -// true meaning "yes, change". If we did see a change, we also set -// m_needs_update to true, so -// future calls to NeedsUpdate will return true. -// exe_scope will be set to the current execution context scope. +// If the current state matches the evaluation point, or the evaluation point +// is already invalid, then we return false, meaning "no change". If the +// current state is different, we update our state, and return true meaning +// "yes, change". If we did see a change, we also set m_needs_update to true, +// so future calls to NeedsUpdate will return true. exe_scope will be set to +// the current execution context scope. bool ValueObject::EvaluationPoint::SyncWithProcessState( bool accept_invalid_exe_ctx) { - // Start with the target, if it is NULL, then we're obviously not going to get - // any further: + // Start with the target, if it is NULL, then we're obviously not going to + // get any further: const bool thread_and_frame_only_if_stopped = true; ExecutionContext exe_ctx( m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped)); @@ -3061,8 +3049,8 @@ ProcessModID current_mod_id = process->GetModID(); // If the current stop id is 0, either we haven't run yet, or the process - // state has been cleared. - // In either case, we aren't going to be able to sync with the process state. + // state has been cleared. In either case, we aren't going to be able to sync + // with the process state. if (current_mod_id.GetStopID() == 0) return false; @@ -3070,8 +3058,8 @@ const bool was_valid = m_mod_id.IsValid(); if (was_valid) { if (m_mod_id == current_mod_id) { - // Everything is already up to date in this object, no need to - // update the execution context scope. + // Everything is already up to date in this object, no need to update the + // execution context scope. changed = false; } else { m_mod_id = current_mod_id; @@ -3081,10 +3069,9 @@ } // Now re-look up the thread and frame in case the underlying objects have - // gone away & been recreated. - // That way we'll be sure to return a valid exe_scope. - // If we used to have a thread or a frame but can't find it anymore, then mark - // ourselves as invalid. + // gone away & been recreated. That way we'll be sure to return a valid + // exe_scope. If we used to have a thread or a frame but can't find it + // anymore, then mark ourselves as invalid. if (!accept_invalid_exe_ctx) { if (m_exe_ctx_ref.HasThreadRef()) { @@ -3299,11 +3286,9 @@ } bool ValueObject::CanProvideValue() { - // we need to support invalid types as providers of values because some - // bare-board - // debugging scenarios have no notion of types, but still manage to have raw - // numeric - // values for things like registers. sigh. + // we need to support invalid types as providers of values because some bare- + // board debugging scenarios have no notion of types, but still manage to + // have raw numeric values for things like registers. sigh. const CompilerType &type(GetCompilerType()); return (false == type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue)); Index: lldb/trunk/source/Core/ValueObjectCast.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectCast.cpp +++ lldb/trunk/source/Core/ValueObjectCast.cpp @@ -71,9 +71,9 @@ m_value.SetCompilerType(compiler_type); SetAddressTypeOfChildren(m_parent->GetAddressTypeOfChildren()); if (!CanProvideValue()) { - // this value object represents an aggregate type whose - // children have values, but this object does not. So we - // say we are changed if our location has changed. + // this value object represents an aggregate type whose children have + // values, but this object does not. So we say we are changed if our + // location has changed. SetValueDidChange(m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); } Index: lldb/trunk/source/Core/ValueObjectChild.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectChild.cpp +++ lldb/trunk/source/Core/ValueObjectChild.cpp @@ -172,8 +172,8 @@ } else if (addr == 0) { m_error.SetErrorString("parent is NULL"); } else { - // Set this object's scalar value to the address of its - // value by adding its byte offset to the parent address + // Set this object's scalar value to the address of its value by + // adding its byte offset to the parent address m_value.GetScalar() += GetByteOffset(); } } break; Index: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp +++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp @@ -122,8 +122,8 @@ return false; } - // Setting our type_sp to NULL will route everything back through our - // parent which is equivalent to not using dynamic values. + // 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) { m_dynamic_type_info.Clear(); return true; @@ -173,8 +173,7 @@ } // Getting the dynamic value may have run the program a bit, and so marked us - // as needing updating, but we really - // don't... + // as needing updating, but we really don't... m_update_point.SetUpdated(); @@ -192,8 +191,8 @@ } // 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? + // parent. Or we could return false, and make ourselves an echo of our + // parent? if (!found_dynamic_type) { if (m_dynamic_type_info) SetValueDidChange(true); @@ -248,14 +247,14 @@ static_cast(this), GetTypeName().GetCString()); if (m_address.IsValid() && m_dynamic_type_info) { - // The variable value is in the Scalar value inside the m_value. - // We can point our m_data right to it. + // The variable value is in the Scalar value inside the m_value. We can + // point our m_data right to it. m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get()); if (m_error.Success()) { if (!CanProvideValue()) { - // this value object represents an aggregate type whose - // children have values, but this object does not. So we - // say we are changed if our location has changed. + // this value object represents an aggregate type whose children have + // values, but this object does not. So we say we are changed if our + // location has changed. SetValueDidChange(m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); } @@ -287,13 +286,11 @@ return false; } - // if we are at an offset from our parent, in order to set ourselves correctly - // we would need - // to change the new value so that it refers to the correct dynamic type. we - // choose not to deal - // with that - if anything more than a value overwrite is required, you should - // be using the - // expression parser instead of the value editing facility + // if we are at an offset from our parent, in order to set ourselves + // correctly we would need to change the new value so that it refers to the + // correct dynamic type. we choose not to deal with that - if anything more + // than a value overwrite is required, you should be using the expression + // parser instead of the value editing facility if (my_value != parent_value) { // but NULL'ing out a value should always be allowed if (strcmp(value_str, "0")) { @@ -322,13 +319,11 @@ return false; } - // if we are at an offset from our parent, in order to set ourselves correctly - // we would need - // to change the new value so that it refers to the correct dynamic type. we - // choose not to deal - // with that - if anything more than a value overwrite is required, you should - // be using the - // expression parser instead of the value editing facility + // if we are at an offset from our parent, in order to set ourselves + // correctly we would need to change the new value so that it refers to the + // correct dynamic type. we choose not to deal with that - if anything more + // than a value overwrite is required, you should be using the expression + // parser instead of the value editing facility if (my_value != parent_value) { // but NULL'ing out a value should always be allowed lldb::offset_t offset = 0; Index: lldb/trunk/source/Core/ValueObjectList.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectList.cpp +++ lldb/trunk/source/Core/ValueObjectList.cpp @@ -87,8 +87,8 @@ collection::iterator pos, end = m_value_objects.end(); for (pos = m_value_objects.begin(); pos != end; ++pos) { - // Watch out for NULL objects in our list as the list - // might get resized to a specific size and lazily filled in + // Watch out for NULL objects in our list as the list might get resized to + // a specific size and lazily filled in ValueObject *valobj = (*pos).get(); if (valobj && valobj->GetID() == uid) { valobj_sp = *pos; Index: lldb/trunk/source/Core/ValueObjectMemory.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectMemory.cpp +++ lldb/trunk/source/Core/ValueObjectMemory.cpp @@ -165,21 +165,20 @@ llvm_unreachable("Unhandled expression result value kind..."); case Value::eValueTypeScalar: - // The variable value is in the Scalar value inside the m_value. - // We can point our m_data right to it. + // The variable value is in the Scalar value inside the m_value. We can + // point our m_data right to it. m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get()); break; case Value::eValueTypeFileAddress: case Value::eValueTypeLoadAddress: case Value::eValueTypeHostAddress: - // The DWARF expression result was an address in the inferior - // process. If this variable is an aggregate type, we just need - // the address as the main value as all child variable objects - // will rely upon this location and add an offset and then read - // their own values as needed. If this variable is a simple - // type, we read all data for it into m_data. - // Make sure this type has a value before we try and read it + // The DWARF expression result was an address in the inferior process. If + // this variable is an aggregate type, we just need the address as the + // main value as all child variable objects will rely upon this location + // and add an offset and then read their own values as needed. If this + // variable is a simple type, we read all data for it into m_data. Make + // sure this type has a value before we try and read it // If we have a file address, convert it to a load address if we can. if (value_type == Value::eValueTypeFileAddress && @@ -192,14 +191,14 @@ } if (!CanProvideValue()) { - // this value object represents an aggregate type whose - // children have values, but this object does not. So we - // say we are changed if our location has changed. + // this value object represents an aggregate type whose children have + // values, but this object does not. So we say we are changed if our + // location has changed. SetValueDidChange(value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); } else { - // Copy the Value and set the context to use our Variable - // so it can extract read its value into m_data appropriately + // Copy the Value and set the context to use our Variable so it can + // extract read its value into m_data appropriately Value value(m_value); if (m_type_sp) value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get()); Index: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp +++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp @@ -171,10 +171,9 @@ m_children_byindex.Clear(); m_name_toindex.Clear(); // usually, an object's value can change but this does not alter its - // children count - // for a synthetic VO that might indeed happen, so we need to tell the upper - // echelons - // that they need to come back to us asking for children + // children count for a synthetic VO that might indeed happen, so we need + // to tell the upper echelons that they need to come back to us asking for + // children m_children_count_valid = false; m_synthetic_children_cache.Clear(); m_synthetic_children_count = UINT32_MAX; Index: lldb/trunk/source/Core/ValueObjectVariable.cpp =================================================================== --- lldb/trunk/source/Core/ValueObjectVariable.cpp +++ lldb/trunk/source/Core/ValueObjectVariable.cpp @@ -175,9 +175,8 @@ switch (value_type) { case Value::eValueTypeFileAddress: // If this type is a pointer, then its children will be considered load - // addresses - // if the pointer or reference is dereferenced, but only if the process - // is alive. + // addresses if the pointer or reference is dereferenced, but only if + // the process is alive. // // There could be global variables like in the following code: // struct LinkedListNode { Foo* foo; LinkedListNode* next; }; @@ -187,14 +186,11 @@ // LinkedListNode g_first_node = { &g_foo1, &g_second_node }; // // When we aren't running, we should be able to look at these variables - // using - // the "target variable" command. Children of the "g_first_node" always - // will - // be of the same address type as the parent. But children of the "next" - // member of - // LinkedListNode will become load addresses if we have a live process, - // or remain - // what a file address if it what a file address. + // using the "target variable" command. Children of the "g_first_node" + // always will be of the same address type as the parent. But children + // of the "next" member of LinkedListNode will become load addresses if + // we have a live process, or remain what a file address if it what a + // file address. if (process_is_alive && is_pointer_or_ref) SetAddressTypeOfChildren(eAddressTypeLoad); else @@ -202,11 +198,9 @@ break; case Value::eValueTypeHostAddress: // Same as above for load addresses, except children of pointer or refs - // are always - // load addresses. Host addresses are used to store freeze dried - // variables. If this - // type is a struct, the entire struct contents will be copied into the - // heap of the + // are always load addresses. Host addresses are used to store freeze + // dried variables. If this type is a struct, the entire struct + // contents will be copied into the heap of the // LLDB process, but we do not currrently follow any pointers. if (is_pointer_or_ref) SetAddressTypeOfChildren(eAddressTypeLoad); @@ -224,8 +218,8 @@ case Value::eValueTypeVector: // fall through case Value::eValueTypeScalar: - // The variable value is in the Scalar value inside the m_value. - // We can point our m_data right to it. + // The variable value is in the Scalar value inside the m_value. We can + // point our m_data right to it. m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get()); break; @@ -233,13 +227,12 @@ case Value::eValueTypeFileAddress: case Value::eValueTypeLoadAddress: case Value::eValueTypeHostAddress: - // The DWARF expression result was an address in the inferior - // process. If this variable is an aggregate type, we just need - // the address as the main value as all child variable objects - // will rely upon this location and add an offset and then read - // their own values as needed. If this variable is a simple - // type, we read all data for it into m_data. - // Make sure this type has a value before we try and read it + // The DWARF expression result was an address in the inferior process. + // If this variable is an aggregate type, we just need the address as + // the main value as all child variable objects will rely upon this + // location and add an offset and then read their own values as needed. + // If this variable is a simple type, we read all data for it into + // m_data. Make sure this type has a value before we try and read it // If we have a file address, convert it to a load address if we can. if (value_type == Value::eValueTypeFileAddress && process_is_alive) { @@ -263,14 +256,14 @@ } if (!CanProvideValue()) { - // this value object represents an aggregate type whose - // children have values, but this object does not. So we - // say we are changed if our location has changed. + // this value object represents an aggregate type whose children have + // values, but this object does not. So we say we are changed if our + // location has changed. SetValueDidChange(value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar()); } else { - // Copy the Value and set the context to use our Variable - // so it can extract read its value into m_data appropriately + // Copy the Value and set the context to use our Variable so it can + // extract read its value into m_data appropriately Value value(m_value); value.SetContext(Value::eContextTypeVariable, variable); m_error = @@ -299,14 +292,13 @@ if (frame) { return m_variable_sp->IsInScope(frame); } else { - // This ValueObject had a frame at one time, but now we - // can't locate it, so return false since we probably aren't - // in scope. + // This ValueObject had a frame at one time, but now we can't locate it, + // so return false since we probably aren't in scope. return false; } } - // We have a variable that wasn't tied to a frame, which - // means it is a global and is always in scope. + // We have a variable that wasn't tied to a frame, which means it is a global + // and is always in scope. return true; } Index: lldb/trunk/source/DataFormatters/FormatManager.cpp =================================================================== --- lldb/trunk/source/DataFormatters/FormatManager.cpp +++ lldb/trunk/source/DataFormatters/FormatManager.cpp @@ -494,8 +494,8 @@ if (valobj.GetNumChildren() == 0) return false; - // ask the type if it has any opinion about this - // eLazyBoolCalculate == no opinion; other values should be self explanatory + // ask the type if it has any opinion about this eLazyBoolCalculate == no + // opinion; other values should be self explanatory CompilerType compiler_type(valobj.GetCompilerType()); if (compiler_type.IsValid()) { switch (compiler_type.ShouldPrintAsOneLiner(&valobj)) { @@ -532,8 +532,7 @@ } // if we decided to define synthetic children for a type, we probably care - // enough - // to show them, but avoid nesting children in children + // enough to show them, but avoid nesting children in children if (child_sp->GetSyntheticChildren().get() != nullptr) { ValueObjectSP synth_sp(child_sp->GetSyntheticValue()); // wait.. wat? just get out of here.. Index: lldb/trunk/source/DataFormatters/StringPrinter.cpp =================================================================== --- lldb/trunk/source/DataFormatters/StringPrinter.cpp +++ lldb/trunk/source/DataFormatters/StringPrinter.cpp @@ -26,9 +26,8 @@ using namespace lldb_private; using namespace lldb_private::formatters; -// we define this for all values of type but only implement it for those we care -// about -// that's good because we get linker errors for any unsupported type +// we define this for all values of type but only implement it for those we +// care about that's good because we get linker errors for any unsupported type template static StringPrinter::StringPrinterBufferPointer<> GetPrintableImpl(uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next); @@ -163,8 +162,8 @@ (unsigned char)*(buffer + 2), (unsigned char)*(buffer + 3)); break; default: - // this is probably some bogus non-character thing - // just print it as-is and hope to sync up again soon + // this is probably some bogus non-character thing just print it as-is and + // hope to sync up again soon retval = {buffer, 1}; next = buffer + 1; return retval; @@ -223,9 +222,9 @@ return retval; } -// Given a sequence of bytes, this function returns: -// a sequence of bytes to actually print out + a length -// the following unscanned position of the buffer is in next +// Given a sequence of bytes, this function returns: a sequence of bytes to +// actually print out + a length the following unscanned position of the buffer +// is in next static StringPrinter::StringPrinterBufferPointer<> GetPrintable(StringPrinter::StringElementType type, uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next) { @@ -321,8 +320,7 @@ (llvm::UTF8 *)utf8_data_buffer_sp->GetBytes(); } else { // just copy the pointers - the cast is necessary to make the compiler - // happy - // but this should only happen if we are reading UTF8 data + // happy but this should only happen if we are reading UTF8 data utf8_data_ptr = const_cast( reinterpret_cast(data_ptr)); utf8_data_end_ptr = const_cast( @@ -344,8 +342,8 @@ } // since we tend to accept partial data (and even partially malformed data) - // we might end up with no NULL terminator before the end_ptr - // hence we need to take a slower route and ensure we stay within boundaries + // we might end up with no NULL terminator before the end_ptr hence we need + // to take a slower route and ensure we stay within boundaries for (; utf8_data_ptr < utf8_data_end_ptr;) { if (zero_is_terminator && !*utf8_data_ptr) break; @@ -472,8 +470,8 @@ } // since we tend to accept partial data (and even partially malformed data) - // we might end up with no NULL terminator before the end_ptr - // hence we need to take a slower route and ensure we stay within boundaries + // we might end up with no NULL terminator before the end_ptr hence we need + // to take a slower route and ensure we stay within boundaries for (uint8_t *data = buffer_sp->GetBytes(); *data && (data < data_end);) { if (escape_non_printables) { uint8_t *next_data = nullptr; Index: lldb/trunk/source/DataFormatters/TypeFormat.cpp =================================================================== --- lldb/trunk/source/DataFormatters/TypeFormat.cpp +++ lldb/trunk/source/DataFormatters/TypeFormat.cpp @@ -111,12 +111,12 @@ valobj->GetBitfieldBitSize(), // Bitfield bit size valobj->GetBitfieldBitOffset(), // Bitfield bit offset exe_scope); - // Given that we do not want to set the ValueObject's m_error - // for a formatting error (or else we wouldn't be able to reformat - // until a next update), an empty string is treated as a "false" - // return from here, but that's about as severe as we get - // CompilerType::DumpTypeValue() should always return - // something, even if that something is an error message + // Given that we do not want to set the ValueObject's m_error for a + // formatting error (or else we wouldn't be able to reformat until a + // next update), an empty string is treated as a "false" return from + // here, but that's about as severe as we get + // CompilerType::DumpTypeValue() should always return something, even + // if that something is an error message dest = sstr.GetString(); } } Index: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp =================================================================== --- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp +++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp @@ -244,8 +244,8 @@ // always show the type at the root level if it is invalid if (show_type) { - // Some ValueObjects don't have types (like registers sets). Only print - // the type if there is one to print + // Some ValueObjects don't have types (like registers sets). Only print the + // type if there is one to print ConstString type_name; if (m_compiler_type.IsValid()) { if (m_options.m_use_type_display_name) @@ -402,12 +402,10 @@ } if (m_error.size()) { // we need to support scenarios in which it is actually fine for a value - // to have no type - // but - on the other hand - if we get an error *AND* have no type, we try - // to get out - // gracefully, since most often that combination means "could not resolve - // a type" - // and the default failure mode is quite ugly + // to have no type but - on the other hand - if we get an error *AND* + // have no type, we try to get out gracefully, since most often that + // combination means "could not resolve a type" and the default failure + // mode is quite ugly if (!m_compiler_type.IsValid()) { m_stream->Printf(" "); return false; @@ -416,10 +414,10 @@ error_printed = true; m_stream->Printf(" <%s>\n", m_error.c_str()); } else { - // Make sure we have a value and make sure the summary didn't - // specify that the value should not be printed - and do not print - // the value if this thing is nil - // (but show the value if the user passes a format explicitly) + // Make sure we have a value and make sure the summary didn't specify + // that the value should not be printed - and do not print the value if + // this thing is nil (but show the value if the user passes a format + // explicitly) TypeSummaryImpl *entry = GetSummaryFormatter(); if (!IsNil() && !IsUninitialized() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue(m_valobj) || @@ -494,8 +492,8 @@ if (is_uninit) return false; - // if the user has specified an element count, always print children - // as it is explicit user demand being honored + // if the user has specified an element count, always print children as it is + // explicit user demand being honored if (m_options.m_pointer_as_array) return true; @@ -505,17 +503,16 @@ return false; if (is_failed_description || m_curr_depth < m_options.m_max_depth) { - // We will show children for all concrete types. We won't show - // pointer contents unless a pointer depth has been specified. - // We won't reference contents unless the reference is the - // root object (depth of zero). + // We will show children for all concrete types. We won't show pointer + // contents unless a pointer depth has been specified. We won't reference + // contents unless the reference is the root object (depth of zero). - // Use a new temporary pointer depth in case we override the - // current pointer depth below... + // Use a new temporary pointer depth in case we override the current + // pointer depth below... if (is_ptr || is_ref) { - // We have a pointer or reference whose value is an address. - // Make sure that address is not NULL + // We have a pointer or reference whose value is an address. Make sure + // that address is not NULL AddressType ptr_address_type; if (m_valobj->GetPointerValue(&ptr_address_type) == 0) return false; @@ -523,10 +520,10 @@ const bool is_root_level = m_curr_depth == 0; if (is_ref && is_root_level) { - // If this is the root object (depth is zero) that we are showing - // and it is a reference, and no pointer depth has been supplied - // print out what it references. Don't do this at deeper depths - // otherwise we can end up with infinite recursion... + // If this is the root object (depth is zero) that we are showing and + // it is a reference, and no pointer depth has been supplied print out + // what it references. Don't do this at deeper depths otherwise we can + // end up with infinite recursion... return true; } @@ -759,8 +756,7 @@ void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed, bool summary_printed) { // this flag controls whether we tried to display a description for this - // object and failed - // if that happens, we want to display the children, if any + // object and failed if that happens, we want to display the children, if any bool is_failed_description = !PrintObjectDescriptionIfNeeded(value_printed, summary_printed); Index: lldb/trunk/source/DataFormatters/VectorType.cpp =================================================================== --- lldb/trunk/source/DataFormatters/VectorType.cpp +++ lldb/trunk/source/DataFormatters/VectorType.cpp @@ -157,9 +157,8 @@ case lldb::eFormatDefault: { // special case the (default, char) combination to actually display as an - // integer value - // most often, you won't want to see the ASCII characters... (and if you do, - // eFormatChar is a keystroke away) + // integer value most often, you won't want to see the ASCII characters... + // (and if you do, eFormatChar is a keystroke away) bool is_char = element_type.IsCharType(); bool is_signed = false; element_type.IsIntegerType(is_signed); Index: lldb/trunk/source/Expression/DWARFExpression.cpp =================================================================== --- lldb/trunk/source/Expression/DWARFExpression.cpp +++ lldb/trunk/source/Expression/DWARFExpression.cpp @@ -679,8 +679,8 @@ error_ptr->Clear(); return true; } else { - // If we get this error, then we need to implement a value - // buffer in the dwarf expression evaluation function... + // If we get this error, then we need to implement a value buffer in + // the dwarf expression evaluation function... if (error_ptr) error_ptr->SetErrorStringWithFormat( "register %s can't be converted to a scalar value", @@ -991,17 +991,17 @@ if (op == DW_OP_addr) { const uint32_t addr_byte_size = m_data.GetAddressByteSize(); - // We have to make a copy of the data as we don't know if this - // data is from a read only memory mapped buffer, so we duplicate - // all of the data first, then modify it, and if all goes well, - // we then replace the data for this expression + // We have to make a copy of the data as we don't know if this data is + // from a read only memory mapped buffer, so we duplicate all of the data + // first, then modify it, and if all goes well, we then replace the data + // for this expression // So first we copy the data into a heap buffer std::unique_ptr head_data_ap( new DataBufferHeap(m_data.GetDataStart(), m_data.GetByteSize())); - // Make en encoder so we can write the address into the buffer using - // the correct byte order (endianness) + // Make en encoder so we can write the address into the buffer using the + // correct byte order (endianness) DataEncoder encoder(head_data_ap->GetBytes(), head_data_ap->GetByteSize(), m_data.GetByteOrder(), addr_byte_size); @@ -1009,9 +1009,8 @@ if (encoder.PutMaxU64(offset, addr_byte_size, file_addr) == UINT32_MAX) return false; - // All went well, so now we can reset the data using a shared - // pointer to the heap data so "m_data" will now correctly - // manage the heap data. + // All went well, so now we can reset the data using a shared pointer to + // the heap data so "m_data" will now correctly manage the heap data. m_data.SetData(DataBufferSP(head_data_ap.release())); return true; } else { @@ -1025,9 +1024,9 @@ } bool DWARFExpression::ContainsThreadLocalStorage() const { - // We are assuming for now that any thread local variable will not - // have a location list. This has been true for all thread local - // variables we have seen so far produced by any compiler. + // We are assuming for now that any thread local variable will not have a + // location list. This has been true for all thread local variables we have + // seen so far produced by any compiler. if (IsLocationList()) return false; lldb::offset_t offset = 0; @@ -1048,24 +1047,24 @@ lldb::ModuleSP new_module_sp, std::function const &link_address_callback) { - // We are assuming for now that any thread local variable will not - // have a location list. This has been true for all thread local - // variables we have seen so far produced by any compiler. + // We are assuming for now that any thread local variable will not have a + // location list. This has been true for all thread local variables we have + // seen so far produced by any compiler. if (IsLocationList()) return false; const uint32_t addr_byte_size = m_data.GetAddressByteSize(); - // We have to make a copy of the data as we don't know if this - // data is from a read only memory mapped buffer, so we duplicate - // all of the data first, then modify it, and if all goes well, - // we then replace the data for this expression + // We have to make a copy of the data as we don't know if this data is from a + // read only memory mapped buffer, so we duplicate all of the data first, + // then modify it, and if all goes well, we then replace the data for this + // expression // So first we copy the data into a heap buffer std::shared_ptr heap_data_sp( new DataBufferHeap(m_data.GetDataStart(), m_data.GetByteSize())); - // Make en encoder so we can write the address into the buffer using - // the correct byte order (endianness) + // Make en encoder so we can write the address into the buffer using the + // correct byte order (endianness) DataEncoder encoder(heap_data_sp->GetBytes(), heap_data_sp->GetByteSize(), m_data.GetByteOrder(), addr_byte_size); @@ -1080,8 +1079,7 @@ switch (op) { case DW_OP_const4u: // Remember the const offset in case we later have a - // DW_OP_form_tls_address - // or DW_OP_GNU_push_tls_address + // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; const_value = m_data.GetU32(&offset); decoded_data = true; @@ -1090,8 +1088,7 @@ case DW_OP_const8u: // Remember the const offset in case we later have a - // DW_OP_form_tls_address - // or DW_OP_GNU_push_tls_address + // DW_OP_form_tls_address or DW_OP_GNU_push_tls_address const_offset = offset; const_value = m_data.GetU64(&offset); decoded_data = true; @@ -1101,21 +1098,15 @@ case DW_OP_form_tls_address: case DW_OP_GNU_push_tls_address: // DW_OP_form_tls_address and DW_OP_GNU_push_tls_address must be preceded - // by - // a file address on the stack. We assume that DW_OP_const4u or - // DW_OP_const8u - // is used for these values, and we check that the last opcode we got - // before - // either of these was DW_OP_const4u or DW_OP_const8u. If so, then we can - // link - // the value accodingly. For Darwin, the value in the DW_OP_const4u or - // DW_OP_const8u is the file address of a structure that contains a - // function - // pointer, the pthread key and the offset into the data pointed to by the - // pthread key. So we must link this address and also set the module of - // this - // expression to the new_module_sp so we can resolve the file address - // correctly + // by a file address on the stack. We assume that DW_OP_const4u or + // DW_OP_const8u is used for these values, and we check that the last + // opcode we got before either of these was DW_OP_const4u or + // DW_OP_const8u. If so, then we can link the value accodingly. For + // Darwin, the value in the DW_OP_const4u or DW_OP_const8u is the file + // address of a structure that contains a function pointer, the pthread + // key and the offset into the data pointed to by the pthread key. So we + // must link this address and also set the module of this expression to + // the new_module_sp so we can resolve the file address correctly if (const_byte_size > 0) { lldb::addr_t linked_file_addr = link_address_callback(const_value); if (linked_file_addr == LLDB_INVALID_ADDRESS) @@ -1144,8 +1135,8 @@ } // If we linked the TLS address correctly, update the module so that when the - // expression - // is evaluated it can resolve the file address to a load address and read the + // expression is evaluated it can resolve the file address to a load address + // and read the // TLS data m_module_wp = new_module_sp; m_data.SetData(heap_data_sp); @@ -1397,11 +1388,11 @@ // The DW_OP_addr_sect_offset4 is used for any location expressions in // shared libraries that have a location like: // DW_OP_addr(0x1000) - // If this address resides in a shared library, then this virtual - // address won't make sense when it is evaluated in the context of a - // running process where shared libraries have been slid. To account for - // this, this new address type where we can store the section pointer - // and a 4 byte offset. + // If this address resides in a shared library, then this virtual address + // won't make sense when it is evaluated in the context of a running + // process where shared libraries have been slid. To account for this, this + // new address type where we can store the section pointer and a 4 byte + // offset. //---------------------------------------------------------------------- // case DW_OP_addr_sect_offset4: // { @@ -1436,9 +1427,9 @@ // OPCODE: DW_OP_deref // OPERANDS: none // DESCRIPTION: Pops the top stack entry and treats it as an address. - // The value retrieved from that address is pushed. The size of the - // data retrieved from the dereferenced address is the size of an - // address on the target machine. + // The value retrieved from that address is pushed. The size of the data + // retrieved from the dereferenced address is the size of an address on the + // target machine. //---------------------------------------------------------------------- case DW_OP_deref: { if (stack.empty()) { @@ -1500,13 +1491,13 @@ // 1 - uint8_t that specifies the size of the data to dereference. // DESCRIPTION: Behaves like the DW_OP_deref operation: it pops the top // stack entry and treats it as an address. The value retrieved from that - // address is pushed. In the DW_OP_deref_size operation, however, the - // size in bytes of the data retrieved from the dereferenced address is + // address is pushed. In the DW_OP_deref_size operation, however, the size + // in bytes of the data retrieved from the dereferenced address is // specified by the single operand. This operand is a 1-byte unsigned // integral constant whose value may not be larger than the size of an - // address on the target machine. The data retrieved is zero extended - // to the size of an address on the target machine before being pushed - // on the expression stack. + // address on the target machine. The data retrieved is zero extended to + // the size of an address on the target machine before being pushed on the + // expression stack. //---------------------------------------------------------------------- case DW_OP_deref_size: { if (stack.empty()) { @@ -1525,8 +1516,7 @@ // I can't decide whether the size operand should apply to the bytes in // their // lldb-host endianness or the target endianness.. I doubt this'll ever - // come up - // but I'll opt for assuming big endian regardless. + // come up but I'll opt for assuming big endian regardless. switch (size) { case 1: ptr = ptr & 0xff; @@ -1622,18 +1612,17 @@ // OPERANDS: 1 // 1 - uint8_t that specifies the size of the data to dereference. // DESCRIPTION: Behaves like the DW_OP_xderef operation: the entry at - // the top of the stack is treated as an address. The second stack - // entry is treated as an "address space identifier" for those - // architectures that support multiple address spaces. The top two - // stack elements are popped, a data item is retrieved through an - // implementation-defined address calculation and pushed as the new - // stack top. In the DW_OP_xderef_size operation, however, the size in - // bytes of the data retrieved from the dereferenced address is - // specified by the single operand. This operand is a 1-byte unsigned - // integral constant whose value may not be larger than the size of an - // address on the target machine. The data retrieved is zero extended - // to the size of an address on the target machine before being pushed - // on the expression stack. + // the top of the stack is treated as an address. The second stack entry is + // treated as an "address space identifier" for those architectures that + // support multiple address spaces. The top two stack elements are popped, + // a data item is retrieved through an implementation-defined address + // calculation and pushed as the new stack top. In the DW_OP_xderef_size + // operation, however, the size in bytes of the data retrieved from the + // dereferenced address is specified by the single operand. This operand is + // a 1-byte unsigned integral constant whose value may not be larger than + // the size of an address on the target machine. The data retrieved is zero + // extended to the size of an address on the target machine before being + // pushed on the expression stack. //---------------------------------------------------------------------- case DW_OP_xderef_size: if (error_ptr) @@ -1643,13 +1632,13 @@ // OPCODE: DW_OP_xderef // OPERANDS: none // DESCRIPTION: Provides an extended dereference mechanism. The entry at - // the top of the stack is treated as an address. The second stack entry - // is treated as an "address space identifier" for those architectures - // that support multiple address spaces. The top two stack elements are - // popped, a data item is retrieved through an implementation-defined - // address calculation and pushed as the new stack top. The size of the - // data retrieved from the dereferenced address is the size of an address - // on the target machine. + // the top of the stack is treated as an address. The second stack entry is + // treated as an "address space identifier" for those architectures that + // support multiple address spaces. The top two stack elements are popped, + // a data item is retrieved through an implementation-defined address + // calculation and pushed as the new stack top. The size of the data + // retrieved from the dereferenced address is the size of an address on the + // target machine. //---------------------------------------------------------------------- case DW_OP_xderef: if (error_ptr) @@ -1661,16 +1650,13 @@ // // Opcode Operand 1 // --------------- ---------------------------------------------------- - // DW_OP_const1u 1-byte unsigned integer constant - // DW_OP_const1s 1-byte signed integer constant - // DW_OP_const2u 2-byte unsigned integer constant - // DW_OP_const2s 2-byte signed integer constant - // DW_OP_const4u 4-byte unsigned integer constant - // DW_OP_const4s 4-byte signed integer constant - // DW_OP_const8u 8-byte unsigned integer constant - // DW_OP_const8s 8-byte signed integer constant - // DW_OP_constu unsigned LEB128 integer constant - // DW_OP_consts signed LEB128 integer constant + // DW_OP_const1u 1-byte unsigned integer constant DW_OP_const1s + // 1-byte signed integer constant DW_OP_const2u 2-byte unsigned integer + // constant DW_OP_const2s 2-byte signed integer constant DW_OP_const4u + // 4-byte unsigned integer constant DW_OP_const4s 4-byte signed integer + // constant DW_OP_const8u 8-byte unsigned integer constant DW_OP_const8s + // 8-byte signed integer constant DW_OP_constu unsigned LEB128 integer + // constant DW_OP_consts signed LEB128 integer constant //---------------------------------------------------------------------- case DW_OP_const1u: stack.push_back(Scalar((uint8_t)opcodes.GetU8(&offset))); @@ -1789,9 +1775,9 @@ // OPCODE: DW_OP_rot // OPERANDS: none // DESCRIPTION: Rotates the first three stack entries. The entry at - // the top of the stack becomes the third stack entry, the second - // entry becomes the top of the stack, and the third entry becomes - // the second entry. + // the top of the stack becomes the third stack entry, the second entry + // becomes the top of the stack, and the third entry becomes the second + // entry. //---------------------------------------------------------------------- case DW_OP_rot: if (stack.size() < 3) { @@ -1853,8 +1839,8 @@ // OPCODE: DW_OP_div // OPERANDS: none // DESCRIPTION: pops the top two stack values, divides the former second - // entry by the former top of the stack using signed division, and - // pushes the result. + // entry by the former top of the stack using signed division, and pushes + // the result. //---------------------------------------------------------------------- case DW_OP_div: if (stack.size() < 2) { @@ -1905,8 +1891,8 @@ // OPCODE: DW_OP_mod // OPERANDS: none // DESCRIPTION: pops the top two stack values and pushes the result of - // the calculation: former second stack entry modulo the former top of - // the stack. + // the calculation: former second stack entry modulo the former top of the + // stack. //---------------------------------------------------------------------- case DW_OP_mod: if (stack.size() < 2) { @@ -2050,8 +2036,8 @@ // OPCODE: DW_OP_shl // OPERANDS: none // DESCRIPTION: pops the top two stack entries, shifts the former - // second entry left by the number of bits specified by the former top - // of the stack, and pushes the result. + // second entry left by the number of bits specified by the former top of + // the stack, and pushes the result. //---------------------------------------------------------------------- case DW_OP_shl: if (stack.size() < 2) { @@ -2096,8 +2082,8 @@ // OPERANDS: none // DESCRIPTION: pops the top two stack entries, shifts the former second // entry right arithmetically (divide the magnitude by 2, keep the same - // sign for the result) by the number of bits specified by the former - // top of the stack, and pushes the result. + // sign for the result) by the number of bits specified by the former top + // of the stack, and pushes the result. //---------------------------------------------------------------------- case DW_OP_shra: if (stack.size() < 2) { @@ -2136,8 +2122,8 @@ // OPCODE: DW_OP_skip // OPERANDS: int16_t // DESCRIPTION: An unconditional branch. Its single operand is a 2-byte - // signed integer constant. The 2-byte constant is the number of bytes - // of the DWARF expression to skip forward or backward from the current + // signed integer constant. The 2-byte constant is the number of bytes of + // the DWARF expression to skip forward or backward from the current // operation, beginning after the 2-byte constant. //---------------------------------------------------------------------- case DW_OP_skip: { @@ -2156,11 +2142,10 @@ // OPCODE: DW_OP_bra // OPERANDS: int16_t // DESCRIPTION: A conditional branch. Its single operand is a 2-byte - // signed integer constant. This operation pops the top of stack. If - // the value popped is not the constant 0, the 2-byte constant operand - // is the number of bytes of the DWARF expression to skip forward or - // backward from the current operation, beginning after the 2-byte - // constant. + // signed integer constant. This operation pops the top of stack. If the + // value popped is not the constant 0, the 2-byte constant operand is the + // number of bytes of the DWARF expression to skip forward or backward from + // the current operation, beginning after the 2-byte constant. //---------------------------------------------------------------------- case DW_OP_bra: if (stack.empty()) { @@ -2537,15 +2522,15 @@ // OPERANDS: 1 // ULEB128: byte size of the piece // DESCRIPTION: The operand describes the size in bytes of the piece of - // the object referenced by the DWARF expression whose result is at the - // top of the stack. If the piece is located in a register, but does not - // occupy the entire register, the placement of the piece within that - // register is defined by the ABI. + // the object referenced by the DWARF expression whose result is at the top + // of the stack. If the piece is located in a register, but does not occupy + // the entire register, the placement of the piece within that register is + // defined by the ABI. // - // Many compilers store a single variable in sets of registers, or store - // a variable partially in memory and partially in registers. - // DW_OP_piece provides a way of describing how large a part of a - // variable a particular DWARF expression refers to. + // Many compilers store a single variable in sets of registers, or store a + // variable partially in memory and partially in registers. DW_OP_piece + // provides a way of describing how large a part of a variable a particular + // DWARF expression refers to. //---------------------------------------------------------------------- case DW_OP_piece: { const uint64_t piece_byte_size = opcodes.GetULEB128(&offset); @@ -2555,8 +2540,8 @@ if (stack.empty()) { // In a multi-piece expression, this means that the current piece is - // not available. - // Fill with zeros for now by resizing the data and appending it + // not available. Fill with zeros for now by resizing the data and + // appending it curr_piece.ResizeData(piece_byte_size); ::memset(curr_piece.GetBuffer().GetBytes(), 0, piece_byte_size); pieces.AppendDataToHostBuffer(curr_piece); @@ -2646,9 +2631,9 @@ // Check if this is the first piece? if (op_piece_offset == 0) { - // This is the first piece, we should push it back onto the stack so - // subsequent - // pieces will be able to access this piece and add to it + // This is the first piece, we should push it back onto the stack + // so subsequent pieces will be able to access this piece and add + // to it if (pieces.AppendDataToHostBuffer(curr_piece) == 0) { if (error_ptr) error_ptr->SetErrorString("failed to append piece data"); @@ -2727,11 +2712,11 @@ // OPCODE: DW_OP_push_object_address // OPERANDS: none // DESCRIPTION: Pushes the address of the object currently being - // evaluated as part of evaluation of a user presented expression. - // This object may correspond to an independent variable described by - // its own DIE or it may be a component of an array, structure, or class - // whose address has been dynamically determined by an earlier step - // during user expression evaluation. + // evaluated as part of evaluation of a user presented expression. This + // object may correspond to an independent variable described by its own + // DIE or it may be a component of an array, structure, or class whose + // address has been dynamically determined by an earlier step during user + // expression evaluation. //---------------------------------------------------------------------- case DW_OP_push_object_address: if (object_address_ptr) @@ -2749,21 +2734,20 @@ // OPERANDS: // uint16_t compile unit relative offset of a DIE // DESCRIPTION: Performs subroutine calls during evaluation - // of a DWARF expression. The operand is the 2-byte unsigned offset - // of a debugging information entry in the current compilation unit. + // of a DWARF expression. The operand is the 2-byte unsigned offset of a + // debugging information entry in the current compilation unit. // // Operand interpretation is exactly like that for DW_FORM_ref2. // - // This operation transfers control of DWARF expression evaluation - // to the DW_AT_location attribute of the referenced DIE. If there is - // no such attribute, then there is no effect. Execution of the DWARF - // expression of a DW_AT_location attribute may add to and/or remove from - // values on the stack. Execution returns to the point following the call - // when the end of the attribute is reached. Values on the stack at the - // time of the call may be used as parameters by the called expression - // and values left on the stack by the called expression may be used as - // return values by prior agreement between the calling and called - // expressions. + // This operation transfers control of DWARF expression evaluation to the + // DW_AT_location attribute of the referenced DIE. If there is no such + // attribute, then there is no effect. Execution of the DWARF expression of + // a DW_AT_location attribute may add to and/or remove from values on the + // stack. Execution returns to the point following the call when the end of + // the attribute is reached. Values on the stack at the time of the call + // may be used as parameters by the called expression and values left on + // the stack by the called expression may be used as return values by prior + // agreement between the calling and called expressions. //---------------------------------------------------------------------- case DW_OP_call2: if (error_ptr) @@ -2774,22 +2758,21 @@ // OPERANDS: 1 // uint32_t compile unit relative offset of a DIE // DESCRIPTION: Performs a subroutine call during evaluation of a DWARF - // expression. For DW_OP_call4, the operand is a 4-byte unsigned offset - // of a debugging information entry in the current compilation unit. + // expression. For DW_OP_call4, the operand is a 4-byte unsigned offset of + // a debugging information entry in the current compilation unit. // // Operand interpretation DW_OP_call4 is exactly like that for // DW_FORM_ref4. // - // This operation transfers control of DWARF expression evaluation - // to the DW_AT_location attribute of the referenced DIE. If there is - // no such attribute, then there is no effect. Execution of the DWARF - // expression of a DW_AT_location attribute may add to and/or remove from - // values on the stack. Execution returns to the point following the call - // when the end of the attribute is reached. Values on the stack at the - // time of the call may be used as parameters by the called expression - // and values left on the stack by the called expression may be used as - // return values by prior agreement between the calling and called - // expressions. + // This operation transfers control of DWARF expression evaluation to the + // DW_AT_location attribute of the referenced DIE. If there is no such + // attribute, then there is no effect. Execution of the DWARF expression of + // a DW_AT_location attribute may add to and/or remove from values on the + // stack. Execution returns to the point following the call when the end of + // the attribute is reached. Values on the stack at the time of the call + // may be used as parameters by the called expression and values left on + // the stack by the called expression may be used as return values by prior + // agreement between the calling and called expressions. //---------------------------------------------------------------------- case DW_OP_call4: if (error_ptr) @@ -2800,9 +2783,8 @@ // OPCODE: DW_OP_stack_value // OPERANDS: None // DESCRIPTION: Specifies that the object does not exist in memory but - // rather is a constant value. The value from the top of the stack is - // the value to be used. This is the actual object value and not the - // location. + // rather is a constant value. The value from the top of the stack is the + // value to be used. This is the actual object value and not the location. //---------------------------------------------------------------------- case DW_OP_stack_value: stack.back().SetValueType(Value::eValueTypeScalar); @@ -2841,8 +2823,8 @@ // opcode, DW_OP_GNU_push_tls_address) // OPERANDS: none // DESCRIPTION: Pops a TLS offset from the stack, converts it to - // an address in the current thread's thread-local storage block, - // and pushes it on the stack. + // an address in the current thread's thread-local storage block, and + // pushes it on the stack. //---------------------------------------------------------------------- case DW_OP_form_tls_address: case DW_OP_GNU_push_tls_address: { @@ -2893,8 +2875,8 @@ // OPERANDS: 1 // ULEB128: index to the .debug_addr section // DESCRIPTION: Pushes an address to the stack from the .debug_addr - // section with the base address specified by the DW_AT_addr_base - // attribute and the 0 based index is the ULEB128 encoded index. + // section with the base address specified by the DW_AT_addr_base attribute + // and the 0 based index is the ULEB128 encoded index. //---------------------------------------------------------------------- case DW_OP_GNU_addr_index: { if (!dwarf_cu) { Index: lldb/trunk/source/Expression/DiagnosticManager.cpp =================================================================== --- lldb/trunk/source/Expression/DiagnosticManager.cpp +++ lldb/trunk/source/Expression/DiagnosticManager.cpp @@ -22,9 +22,8 @@ std::string str = GetString(); - // GetString() puts a separator after each diagnostic. - // We want to remove the last '\n' because log->PutCString will add one for - // us. + // GetString() puts a separator after each diagnostic. We want to remove the + // last '\n' because log->PutCString will add one for us. if (str.size() && str.back() == '\n') { str.pop_back(); Index: lldb/trunk/source/Expression/ExpressionSourceCode.cpp =================================================================== --- lldb/trunk/source/Expression/ExpressionSourceCode.cpp +++ lldb/trunk/source/Expression/ExpressionSourceCode.cpp @@ -93,15 +93,15 @@ m_state = CURRENT_FILE_POPPED; } - // An entry is valid if it occurs before the current line in - // the current file. + // An entry is valid if it occurs before the current line in the current + // file. bool IsValidEntry(uint32_t line) { switch (m_state) { case CURRENT_FILE_NOT_YET_PUSHED: return true; case CURRENT_FILE_PUSHED: - // If we are in file included in the current file, - // the entry should be added. + // If we are in file included in the current file, the entry should be + // added. if (m_file_stack.back() != m_current_file) return true; Index: lldb/trunk/source/Expression/ExpressionVariable.cpp =================================================================== --- lldb/trunk/source/Expression/ExpressionVariable.cpp +++ lldb/trunk/source/Expression/ExpressionVariable.cpp @@ -69,8 +69,8 @@ execution_unit_sp->GetJittedGlobalVariables()) { if (global_var.m_remote_addr != LLDB_INVALID_ADDRESS) { // Demangle the name before inserting it, so that lookups by the ConstStr - // of the demangled name - // will find the mangled one (needed for looking up metadata pointers.) + // of the demangled name will find the mangled one (needed for looking up + // metadata pointers.) Mangled mangler(global_var.m_name); mangler.GetDemangledName(lldb::eLanguageTypeUnknown); m_symbol_map[global_var.m_name.GetCString()] = global_var.m_remote_addr; Index: lldb/trunk/source/Expression/FunctionCaller.cpp =================================================================== --- lldb/trunk/source/Expression/FunctionCaller.cpp +++ lldb/trunk/source/Expression/FunctionCaller.cpp @@ -318,9 +318,9 @@ DiagnosticManager &diagnostic_manager, Value &results) { lldb::ExpressionResults return_value = lldb::eExpressionSetupError; - // FunctionCaller::ExecuteFunction execution is always just to get the result. - // Do make sure we ignore - // breakpoints, unwind on error, and don't try to debug it. + // FunctionCaller::ExecuteFunction execution is always just to get the + // result. Do make sure we ignore breakpoints, unwind on error, and don't try + // to debug it. EvaluateExpressionOptions real_options = options; real_options.SetDebug(false); real_options.SetUnwindOnError(true); @@ -355,9 +355,8 @@ return lldb::eExpressionSetupError; // We need to make sure we record the fact that we are running an expression - // here - // otherwise this fact will fail to be recorded when fetching an Objective-C - // object description + // here otherwise this fact will fail to be recorded when fetching an + // Objective-C object description if (exe_ctx.GetProcessPtr()) exe_ctx.GetProcessPtr()->SetRunningUserExpression(true); Index: lldb/trunk/source/Expression/IRExecutionUnit.cpp =================================================================== --- lldb/trunk/source/Expression/IRExecutionUnit.cpp +++ lldb/trunk/source/Expression/IRExecutionUnit.cpp @@ -362,13 +362,10 @@ ReportAllocations(*m_execution_engine_ap); // We have to do this after calling ReportAllocations because for the MCJIT, - // getGlobalValueAddress - // will cause the JIT to perform all relocations. That can only be done once, - // and has to happen - // after we do the remapping from local -> remote. - // That means we don't know the local address of the Variables, but we don't - // need that for anything, - // so that's okay. + // getGlobalValueAddress will cause the JIT to perform all relocations. That + // can only be done once, and has to happen after we do the remapping from + // local -> remote. That means we don't know the local address of the + // Variables, but we don't need that for anything, so that's okay. std::function RegisterOneValue = [this]( llvm::GlobalValue &val) { @@ -379,8 +376,8 @@ lldb::addr_t remote_addr = GetRemoteAddressForLocal(var_ptr_addr); // This is a really unfortunae API that sometimes returns local addresses - // and sometimes returns remote addresses, based on whether - // the variable was relocated during ReportAllocations or not. + // and sometimes returns remote addresses, based on whether the variable + // was relocated during ReportAllocations or not. if (remote_addr == LLDB_INVALID_ADDRESS) { remote_addr = var_ptr_addr; @@ -882,8 +879,8 @@ if (get_external_load_address(load_address, sc_list, sc)) { return load_address; } - // if there are any searches we try after this, add an sc_list.Clear() in an - // "else" clause here + // if there are any searches we try after this, add an sc_list.Clear() in + // an "else" clause here if (best_internal_load_address != LLDB_INVALID_ADDRESS) { return best_internal_load_address; Index: lldb/trunk/source/Expression/IRInterpreter.cpp =================================================================== --- lldb/trunk/source/Expression/IRInterpreter.cpp +++ lldb/trunk/source/Expression/IRInterpreter.cpp @@ -1567,8 +1567,8 @@ return false; } - // Push all function arguments to the argument list that will - // be passed to the call function thread plan + // Push all function arguments to the argument list that will be passed + // to the call function thread plan for (int i = 0; i < numArgs; i++) { // Get details of this argument llvm::Value *arg_op = call_inst->getArgOperand(i); Index: lldb/trunk/source/Expression/IRMemoryMap.cpp =================================================================== --- lldb/trunk/source/Expression/IRMemoryMap.cpp +++ lldb/trunk/source/Expression/IRMemoryMap.cpp @@ -49,8 +49,8 @@ // // The memory returned by this function will never be written to. The only // point is that it should not shadow process memory if possible, so that - // expressions processing real values from the process do not use the - // wrong data. + // expressions processing real values from the process do not use the wrong + // data. // // If the process can in fact allocate memory (CanJIT() lets us know this) // then this can be accomplished just be allocating memory in the inferior. @@ -93,8 +93,8 @@ } // Now, if it's possible to use the GetMemoryRegionInfo API to detect mapped - // regions, walk forward through memory until a region is found that - // has adequate space for our allocation. + // regions, walk forward through memory until a region is found that has + // adequate space for our allocation. if (process_is_alive) { const uint64_t end_of_memory = process_sp->GetAddressByteSize() == 8 ? 0xffffffffffffffffull @@ -188,16 +188,12 @@ AllocationMap::const_iterator iter = m_allocations.lower_bound(addr); // Since we only know that the returned interval begins at a location greater - // than or - // equal to where the given interval begins, it's possible that the given - // interval - // intersects either the returned interval or the previous interval. Thus, we - // need to - // check both. Note that we only need to check these two intervals. Since all - // intervals - // are disjoint it is not possible that an adjacent interval does not - // intersect, but a - // non-adjacent interval does intersect. + // than or equal to where the given interval begins, it's possible that the + // given interval intersects either the returned interval or the previous + // interval. Thus, we need to check both. Note that we only need to check + // these two intervals. Since all intervals are disjoint it is not possible + // that an adjacent interval does not intersect, but a non-adjacent interval + // does intersect. if (iter != m_allocations.end()) { if (AllocationsIntersect(addr, size, iter->second.m_process_start, iter->second.m_size)) @@ -217,16 +213,15 @@ bool IRMemoryMap::AllocationsIntersect(lldb::addr_t addr1, size_t size1, lldb::addr_t addr2, size_t size2) { // Given two half open intervals [A, B) and [X, Y), the only 6 permutations - // that satisfy - // Am_live_sp) { // If the reference comes from the program, then the - // ClangExpressionVariable's - // live variable data hasn't been set up yet. Do this now. + // ClangExpressionVariable's live variable data hasn't been set up yet. + // Do this now. lldb::addr_t location; Status read_error; @@ -256,10 +257,8 @@ frame_bottom != LLDB_INVALID_ADDRESS && location >= frame_bottom && location <= frame_top) { // If the variable is resident in the stack frame created by the - // expression, - // then it cannot be relied upon to stay around. We treat it as - // needing - // reallocation. + // expression, then it cannot be relied upon to stay around. We + // treat it as needing reallocation. m_persistent_variable_sp->m_flags |= ExpressionVariable::EVIsLLDBAllocated; m_persistent_variable_sp->m_flags |= Index: lldb/trunk/source/Expression/REPL.cpp =================================================================== --- lldb/trunk/source/Expression/REPL.cpp +++ lldb/trunk/source/Expression/REPL.cpp @@ -243,10 +243,8 @@ IOHandler::Type::REPL, IOHandler::Type::CommandInterpreter)) { // We typed "quit" or an alias to quit so we need to check if the // command interpreter is above us and tell it that it is done as - // well - // so we don't drop back into the command interpreter if we have - // already - // quit + // well so we don't drop back into the command interpreter if we + // have already quit lldb::IOHandlerSP io_handler_sp(ci.GetIOHandler()); if (io_handler_sp) io_handler_sp->SetIsDone(true); @@ -444,8 +442,8 @@ } } - // Don't complain about the REPL process going away if we are in the process - // of quitting. + // Don't complain about the REPL process going away if we are in the + // process of quitting. if (!did_quit && (!process_sp || !process_sp->IsAlive())) { error_sp->Printf( "error: REPL process is no longer alive, exiting REPL\n"); @@ -542,11 +540,9 @@ debugger.PushIOHandler(io_handler_sp); - // Check if we are in dedicated REPL mode where LLDB was start with the - // "--repl" option - // from the command line. Currently we know this by checking if the debugger - // already - // has a IOHandler thread. + // Check if we are in dedicated REPL mode where LLDB was start with the "-- + // repl" option from the command line. Currently we know this by checking if + // the debugger already has a IOHandler thread. if (!debugger.HasIOHandlerThread()) { // The debugger doesn't have an existing IOHandler thread, so this must be // dedicated REPL mode... @@ -566,8 +562,8 @@ io_handler_sp->WaitForPop(); if (m_dedicated_repl_mode) { - // If we were in dedicated REPL mode we would have started the - // IOHandler thread, and we should kill our process + // If we were in dedicated REPL mode we would have started the IOHandler + // thread, and we should kill our process lldb::ProcessSP process_sp = m_target.GetProcessSP(); if (process_sp && process_sp->IsAlive()) process_sp->Destroy(false); Index: lldb/trunk/source/Expression/UserExpression.cpp =================================================================== --- lldb/trunk/source/Expression/UserExpression.cpp +++ lldb/trunk/source/Expression/UserExpression.cpp @@ -179,9 +179,8 @@ execution_policy = eExecutionPolicyNever; // We need to set the expression execution thread here, turns out parse can - // call functions in the process of - // looking up symbols, which will escape the context set by exe_ctx passed to - // Execute. + // call functions in the process of looking up symbols, which will escape the + // context set by exe_ctx passed to Execute. lldb::ThreadSP thread_sp = exe_ctx.GetThreadSP(); ThreadList::ExpressionExecutionThreadPusher execution_thread_pusher( thread_sp); @@ -198,9 +197,9 @@ else full_prefix = option_prefix; - // If the language was not specified in the expression command, - // set it to the language in the target's properties if - // specified, else default to the langage for the frame. + // If the language was not specified in the expression command, set it to the + // language in the target's properties if specified, else default to the + // langage for the frame. if (language == lldb::eLanguageTypeUnknown) { if (target->GetLanguage() != lldb::eLanguageTypeUnknown) language = target->GetLanguage(); Index: lldb/trunk/source/Host/android/HostInfoAndroid.cpp =================================================================== --- lldb/trunk/source/Host/android/HostInfoAndroid.cpp +++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp @@ -79,13 +79,10 @@ bool success = HostInfoLinux::ComputeTempFileBaseDirectory(file_spec); // On Android, there is no path which is guaranteed to be writable. If the - // user has not - // provided a path via an environment variable, the generic algorithm will - // deduce /tmp, which - // is plain wrong. In that case we have an invalid directory, we substitute - // the path with - // /data/local/tmp, which is correct at least in some cases (i.e., when - // running as shell user). + // user has not provided a path via an environment variable, the generic + // algorithm will deduce /tmp, which is plain wrong. In that case we have an + // invalid directory, we substitute the path with /data/local/tmp, which is + // correct at least in some cases (i.e., when running as shell user). if (!success || !file_spec.Exists()) file_spec = FileSpec("/data/local/tmp", false); Index: lldb/trunk/source/Host/common/Editline.cpp =================================================================== --- lldb/trunk/source/Host/common/Editline.cpp +++ lldb/trunk/source/Host/common/Editline.cpp @@ -33,8 +33,8 @@ // doesn't explicitly initialize the curses termcap library, which it gets away // with until TERM is set to VT100 where it stumbles over an implementation // assumption that may not exist on other platforms. The setupterm() function -// would normally require headers that don't work gracefully in this context, so -// the function declaraction has been hoisted here. +// would normally require headers that don't work gracefully in this context, +// so the function declaraction has been hoisted here. #if defined(__APPLE__) extern "C" { int setupterm(char *term, int fildes, int *errret); @@ -43,12 +43,10 @@ #endif // Editline uses careful cursor management to achieve the illusion of editing a -// multi-line block of text -// with a single line editor. Preserving this illusion requires fairly careful -// management of cursor -// state. Read and understand the relationship between DisplayInput(), -// MoveCursor(), SetCurrentLine(), -// and SaveEditedLine() before making changes. +// multi-line block of text with a single line editor. Preserving this +// illusion requires fairly careful management of cursor state. Read and +// understand the relationship between DisplayInput(), MoveCursor(), +// SetCurrentLine(), and SaveEditedLine() before making changes. #define ESCAPE "\x1b" #define ANSI_FAINT ESCAPE "[2m" @@ -70,8 +68,7 @@ #define EditLineStringFormatSpec "%s" // use #defines so wide version functions and structs will resolve to old -// versions -// for case of libedit not built with wide char support +// versions for case of libedit not built with wide char support #define history_w history #define history_winit history_init #define history_wend history_end @@ -145,10 +142,8 @@ // FIXME: This will be broken on Windows if we ever re-enable Editline. You // can't use select // on something that isn't a socket. This will have to be re-written to not - // use a FILE*, but - // instead use some kind of yet-to-be-created abstraction that select-like - // functionality on - // non-socket objects. + // use a FILE*, but instead use some kind of yet-to-be-created abstraction + // that select-like functionality on non-socket objects. const int fd = fileno(file); SelectHelper select_helper; select_helper.SetTimeout(std::chrono::microseconds(0)); @@ -160,13 +155,13 @@ namespace line_editor { typedef std::weak_ptr EditlineHistoryWP; -// EditlineHistory objects are sometimes shared between multiple -// Editline instances with the same program name. +// EditlineHistory objects are sometimes shared between multiple Editline +// instances with the same program name. class EditlineHistory { private: - // Use static GetHistory() function to get a EditlineHistorySP to one of these - // objects + // Use static GetHistory() function to get a EditlineHistorySP to one of + // these objects EditlineHistory(const std::string &prefix, uint32_t size, bool unique_entries) : m_history(NULL), m_event(), m_prefix(prefix), m_path() { m_history = history_winit(); @@ -436,11 +431,10 @@ if (history_w(pHistory, &history_event, H_FIRST) == -1) return CC_ERROR; - // Save any edits to the "live" entry in case we return by moving forward in - // history - // (it would be more bash-like to save over any current entry, but libedit - // doesn't - // offer the ability to add entries anywhere except the end.) + // Save any edits to the "live" entry in case we return by moving forward + // in history (it would be more bash-like to save over any current entry, + // but libedit doesn't offer the ability to add entries anywhere except the + // end.) SaveEditedLine(); m_live_history_lines = m_input_lines; m_in_history = true; @@ -466,8 +460,7 @@ DisplayInput(); // Prepare to edit the last line when moving to previous entry, or the first - // line - // when moving to next entry + // line when moving to next entry SetCurrentLine(m_current_line_index = earlier ? (int)m_input_lines.size() - 1 : 0); MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingPrompt); @@ -490,8 +483,8 @@ } if (m_multiline_enabled) { - // Detect when the number of rows used for this input line changes due to an - // edit + // Detect when the number of rows used for this input line changes due to + // an edit int lineLength = (int)((info->lastchar - info->buffer) + GetPromptWidth()); int new_line_rows = (lineLength / m_terminal_width) + 1; if (m_current_line_rows != -1 && new_line_rows != m_current_line_rows) { @@ -510,12 +503,10 @@ char ch = 0; // This mutex is locked by our caller (GetLine). Unlock it while we read a - // character - // (blocking operation), so we do not hold the mutex indefinitely. This - // gives a chance - // for someone to interrupt us. After Read returns, immediately lock the - // mutex again and - // check if we were interrupted. + // character (blocking operation), so we do not hold the mutex + // indefinitely. This gives a chance for someone to interrupt us. After + // Read returns, immediately lock the mutex again and check if we were + // interrupted. m_output_mutex.unlock(); int read_count = m_input_connection.Read(&ch, 1, llvm::None, status, NULL); m_output_mutex.lock(); @@ -614,7 +605,8 @@ // Save any edits to this line SaveEditedLine(); - // If this is the end of the last line, consider whether to add a line instead + // If this is the end of the last line, consider whether to add a line + // instead const LineInfoW *info = el_wline(m_editline); if (m_current_line_index == m_input_lines.size() - 1 && info->cursor == info->lastchar) { @@ -653,8 +645,8 @@ return CC_REFRESH; } - // Fail when at the end of the last line, except when ^D is pressed on - // the line is empty, in which case it is treated as EOF + // Fail when at the end of the last line, except when ^D is pressed on the + // line is empty, in which case it is treated as EOF if (m_current_line_index == m_input_lines.size() - 1) { if (ch == 4 && info->buffer == info->lastchar) { fprintf(m_output_file, "^D\n"); @@ -685,7 +677,8 @@ unsigned char Editline::DeletePreviousCharCommand(int ch) { LineInfoW *info = const_cast(el_wline(m_editline)); - // Just delete the previous character normally when not at the start of a line + // Just delete the previous character normally when not at the start of a + // line if (info->cursor > info->buffer) { el_deletestr(m_editline, 1); return CC_REFRESH; @@ -709,8 +702,7 @@ DisplayInput(m_current_line_index); // Put the cursor back where libedit expects it to be before returning to - // editing - // by telling libedit about the newly inserted text + // editing by telling libedit about the newly inserted text MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingPrompt); el_winsertstr(m_editline, priorLine.c_str()); return CC_REDISPLAY; @@ -762,7 +754,8 @@ EditLineStringType(indentation, EditLineCharType(' '))); } - // Move down past the current line using newlines to force scrolling if needed + // Move down past the current line using newlines to force scrolling if + // needed SetCurrentLine(m_current_line_index + 1); const LineInfoW *info = el_wline(m_editline); int cursor_position = (int)((info->cursor - info->buffer) + GetPromptWidth()); @@ -824,8 +817,7 @@ DisplayInput(m_current_line_index); // Reposition the cursor back on the original line and prepare to restart - // editing - // with a new cursor position + // editing with a new cursor position SetCurrentLine(m_current_line_index); MoveCursor(CursorLocation::BlockEnd, CursorLocation::EditingPrompt); m_revert_cursor_index = cursor_position + indent_correction; @@ -945,9 +937,9 @@ m_multiline_enabled = multiline; if (m_editline) { - // Disable edit mode to stop the terminal from flushing all input - // during the call to el_end() since we expect to have multiple editline - // instances in this program. + // Disable edit mode to stop the terminal from flushing all input during + // the call to el_end() since we expect to have multiple editline instances + // in this program. el_set(m_editline, EL_EDITMODE, 0); el_end(m_editline); } @@ -973,7 +965,8 @@ return Editline::InstanceFor(editline)->GetCharacter(c); })); - // Commands used for multiline support, registered whether or not they're used + // Commands used for multiline support, registered whether or not they're + // used el_wset(m_editline, EL_ADDFN, EditLineConstString("lldb-break-line"), EditLineConstString("Insert a line break"), (EditlineCommandCallbackType)([](EditLine *editline, int ch) { @@ -1031,13 +1024,11 @@ return Editline::InstanceFor(editline)->FixIndentationCommand(ch); })); - // Register the complete callback under two names for compatibility with older - // clients using - // custom .editrc files (largely because libedit has a bad bug where if you - // have a bind command - // that tries to bind to a function name that doesn't exist, it can corrupt - // the heap and - // crash your process later.) + // Register the complete callback under two names for compatibility with + // older clients using custom .editrc files (largely because libedit has a + // bad bug where if you have a bind command that tries to bind to a function + // name that doesn't exist, it can corrupt the heap and crash your process + // later.) EditlineCommandCallbackType complete_callback = [](EditLine *editline, int ch) { return Editline::InstanceFor(editline)->TabCommand(ch); @@ -1118,8 +1109,7 @@ NULL); // Escape is absorbed exiting edit mode, so re-register important - // sequences - // without the prefix + // sequences without the prefix el_set(m_editline, EL_BIND, "-a", "[A", "lldb-previous-line", NULL); el_set(m_editline, EL_BIND, "-a", "[B", "lldb-next-line", NULL); el_set(m_editline, EL_BIND, "-a", "[\\^", "lldb-revert-line", NULL); @@ -1176,18 +1166,18 @@ Editline::~Editline() { if (m_editline) { - // Disable edit mode to stop the terminal from flushing all input - // during the call to el_end() since we expect to have multiple editline - // instances in this program. + // Disable edit mode to stop the terminal from flushing all input during + // the call to el_end() since we expect to have multiple editline instances + // in this program. el_set(m_editline, EL_EDITMODE, 0); el_end(m_editline); m_editline = nullptr; } - // EditlineHistory objects are sometimes shared between multiple - // Editline instances with the same program name. So just release - // our shared pointer and if we are the last owner, it will save the - // history to the history save file automatically. + // EditlineHistory objects are sometimes shared between multiple Editline + // instances with the same program name. So just release our shared pointer + // and if we are the last owner, it will save the history to the history save + // file automatically. m_history_sp.reset(); } @@ -1313,8 +1303,8 @@ bool &interrupted) { ConfigureEditor(true); - // Print the initial input lines, then move the cursor back up to the start of - // input + // Print the initial input lines, then move the cursor back up to the start + // of input SetBaseLineNumber(first_line_number); m_input_lines = std::vector(); m_input_lines.insert(m_input_lines.begin(), EditLineConstString("")); Index: lldb/trunk/source/Host/common/File.cpp =================================================================== --- lldb/trunk/source/Host/common/File.cpp +++ lldb/trunk/source/Host/common/File.cpp @@ -126,8 +126,8 @@ const char *mode = GetStreamOpenModeFromOptions(m_options); if (mode) { if (!m_should_close_fd) { -// We must duplicate the file descriptor if we don't own it because -// when you call fdopen, the stream will own the fd +// We must duplicate the file descriptor if we don't own it because when you +// call fdopen, the stream will own the fd #ifdef _WIN32 m_descriptor = ::_dup(GetDescriptor()); #else @@ -139,8 +139,8 @@ m_stream = llvm::sys::RetryAfterSignal(nullptr, ::fdopen, m_descriptor, mode); - // If we got a stream, then we own the stream and should no - // longer own the descriptor because fclose() will close it for us + // If we got a stream, then we own the stream and should no longer own + // the descriptor because fclose() will close it for us if (m_stream) { m_own_stream = true; Index: lldb/trunk/source/Host/common/Host.cpp =================================================================== --- lldb/trunk/source/Host/common/Host.cpp +++ lldb/trunk/source/Host/common/Host.cpp @@ -119,9 +119,8 @@ #ifndef __linux__ //------------------------------------------------------------------ -// Scoped class that will disable thread canceling when it is -// constructed, and exception safely restore the previous value it -// when it goes out of scope. +// Scoped class that will disable thread canceling when it is constructed, and +// exception safely restore the previous value it when it goes out of scope. //------------------------------------------------------------------ class ScopedPThreadCancelDisabler { public: @@ -270,8 +269,7 @@ __FUNCTION__, arg); break; } - // If the callback returns true, it means this process should - // exit + // If the callback returns true, it means this process should exit if (callback_return) { if (log) log->Printf("%s (arg = %p) thread exiting because callback " @@ -497,9 +495,9 @@ llvm::SmallString output_file_path; if (command_output_ptr) { - // Create a temporary file to get the stdout/stderr and redirect the - // output of the command into this file. We will later read this file - // if all goes well and fill the data into "command_output_ptr" + // Create a temporary file to get the stdout/stderr and redirect the output + // of the command into this file. We will later read this file if all goes + // well and fill the data into "command_output_ptr" FileSpec tmpdir_file_spec; if (HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, tmpdir_file_spec)) { tmpdir_file_spec.AppendPathComponent("lldb-shell-output.%%%%%%"); @@ -580,7 +578,8 @@ return error; } -// The functions below implement process launching for non-Apple-based platforms +// The functions below implement process launching for non-Apple-based +// platforms #if !defined(__APPLE__) Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { std::unique_ptr delegate_launcher; @@ -595,8 +594,7 @@ HostProcess process = launcher.LaunchProcess(launch_info, error); // TODO(zturner): It would be better if the entire HostProcess were returned - // instead of writing - // it into this structure. + // instead of writing it into this structure. launch_info.SetProcessID(process.GetProcessId()); return error; Index: lldb/trunk/source/Host/common/HostInfoBase.cpp =================================================================== --- lldb/trunk/source/Host/common/HostInfoBase.cpp +++ lldb/trunk/source/Host/common/HostInfoBase.cpp @@ -33,19 +33,19 @@ namespace { //---------------------------------------------------------------------- -// The HostInfoBaseFields is a work around for windows not supporting -// static variables correctly in a thread safe way. Really each of the -// variables in HostInfoBaseFields should live in the functions in which -// they are used and each one should be static, but the work around is -// in place to avoid this restriction. Ick. +// The HostInfoBaseFields is a work around for windows not supporting static +// variables correctly in a thread safe way. Really each of the variables in +// HostInfoBaseFields should live in the functions in which they are used and +// each one should be static, but the work around is in place to avoid this +// restriction. Ick. //---------------------------------------------------------------------- struct HostInfoBaseFields { ~HostInfoBaseFields() { if (m_lldb_process_tmp_dir.Exists()) { // Remove the LLDB temporary directory if we have one. Set "recurse" to - // true to all files that were created for the LLDB process can be cleaned - // up. + // true to all files that were created for the LLDB process can be + // cleaned up. llvm::sys::fs::remove_directories(m_lldb_process_tmp_dir.GetPath()); } } @@ -354,8 +354,8 @@ bool HostInfoBase::ComputeClangDirectory(FileSpec &file_spec) { return false; } bool HostInfoBase::ComputeUserPluginsDirectory(FileSpec &file_spec) { - // TODO(zturner): Figure out how to compute the user plugins directory for all - // platforms. + // TODO(zturner): Figure out how to compute the user plugins directory for + // all platforms. return false; } Index: lldb/trunk/source/Host/common/MainLoop.cpp =================================================================== --- lldb/trunk/source/Host/common/MainLoop.cpp +++ lldb/trunk/source/Host/common/MainLoop.cpp @@ -209,8 +209,8 @@ void MainLoop::RunImpl::ProcessEvents() { #ifdef __ANDROID__ - // Collect first all readable file descriptors into a separate vector and then - // iterate over it to invoke callbacks. Iterating directly over + // Collect first all readable file descriptors into a separate vector and + // then iterate over it to invoke callbacks. Iterating directly over // loop.m_read_fds is not possible because the callbacks can modify the // container which could invalidate the iterator. std::vector fds; @@ -285,8 +285,7 @@ } // We shall block the signal, then install the signal handler. The signal will -// be unblocked in -// the Run() function to check for signal delivery. +// be unblocked in the Run() function to check for signal delivery. MainLoop::SignalHandleUP MainLoop::RegisterSignal(int signo, const Callback &callback, Status &error) { #ifdef SIGNAL_POLLING_UNSUPPORTED @@ -321,9 +320,9 @@ assert(ret == 0); #endif - // If we're using kqueue, the signal needs to be unblocked in order to recieve - // it. If using pselect/ppoll, we need to block it, and later unblock it as a - // part of the system call. + // If we're using kqueue, the signal needs to be unblocked in order to + // recieve it. If using pselect/ppoll, we need to block it, and later unblock + // it as a part of the system call. ret = pthread_sigmask(HAVE_SYS_EVENT_H ? SIG_UNBLOCK : SIG_BLOCK, &new_action.sa_mask, &old_set); assert(ret == 0 && "pthread_sigmask failed"); Index: lldb/trunk/source/Host/common/NativeBreakpointList.cpp =================================================================== --- lldb/trunk/source/Host/common/NativeBreakpointList.cpp +++ lldb/trunk/source/Host/common/NativeBreakpointList.cpp @@ -104,8 +104,8 @@ return error; } - // Breakpoint has no more references. Disable it if it's not - // already disabled. + // Breakpoint has no more references. Disable it if it's not already + // disabled. if (log) log->Printf("NativeBreakpointList::%s addr = 0x%" PRIx64 " -- removing due to no remaining references", Index: lldb/trunk/source/Host/common/NativeProcessProtocol.cpp =================================================================== --- lldb/trunk/source/Host/common/NativeProcessProtocol.cpp +++ lldb/trunk/source/Host/common/NativeProcessProtocol.cpp @@ -137,29 +137,28 @@ Status NativeProcessProtocol::SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) { - // This default implementation assumes setting the watchpoint for - // the process will require setting the watchpoint for each of the - // threads. Furthermore, it will track watchpoints set for the - // process and will add them to each thread that is attached to - // via the (FIXME implement) OnThreadAttached () method. + // This default implementation assumes setting the watchpoint for the process + // will require setting the watchpoint for each of the threads. Furthermore, + // it will track watchpoints set for the process and will add them to each + // thread that is attached to via the (FIXME implement) OnThreadAttached () + // method. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Update the thread list UpdateThreads(); - // Keep track of the threads we successfully set the watchpoint - // for. If one of the thread watchpoint setting operations fails, - // back off and remove the watchpoint for all the threads that - // were successfully set so we get back to a consistent state. + // Keep track of the threads we successfully set the watchpoint for. If one + // of the thread watchpoint setting operations fails, back off and remove the + // watchpoint for all the threads that were successfully set so we get back + // to a consistent state. std::vector watchpoint_established_threads; - // Tell each thread to set a watchpoint. In the event that - // hardware watchpoints are requested but the SetWatchpoint fails, - // try to set a software watchpoint as a fallback. It's - // conceivable that if there are more threads than hardware - // watchpoints available, some of the threads will fail to set - // hardware watchpoints while software ones may be available. + // Tell each thread to set a watchpoint. In the event that hardware + // watchpoints are requested but the SetWatchpoint fails, try to set a + // software watchpoint as a fallback. It's conceivable that if there are + // more threads than hardware watchpoints available, some of the threads will + // fail to set hardware watchpoints while software ones may be available. std::lock_guard guard(m_threads_mutex); for (const auto &thread : m_threads) { assert(thread && "thread list should not have a NULL thread!"); @@ -167,8 +166,8 @@ Status thread_error = thread->SetWatchpoint(addr, size, watch_flags, hardware); if (thread_error.Fail() && hardware) { - // Try software watchpoints since we failed on hardware watchpoint setting - // and we may have just run out of hardware watchpoints. + // Try software watchpoints since we failed on hardware watchpoint + // setting and we may have just run out of hardware watchpoints. thread_error = thread->SetWatchpoint(addr, size, watch_flags, false); if (thread_error.Success()) LLDB_LOG(log, @@ -176,13 +175,12 @@ } if (thread_error.Success()) { - // Remember that we set this watchpoint successfully in - // case we need to clear it later. + // Remember that we set this watchpoint successfully in case we need to + // clear it later. watchpoint_established_threads.push_back(thread.get()); } else { - // Unset the watchpoint for each thread we successfully - // set so that we get back to a consistent state of "not - // set" for the watchpoint. + // Unset the watchpoint for each thread we successfully set so that we + // get back to a consistent state of "not set" for the watchpoint. for (auto unwatch_thread_sp : watchpoint_established_threads) { Status remove_error = unwatch_thread_sp->RemoveWatchpoint(addr); if (remove_error.Fail()) @@ -208,9 +206,9 @@ const Status thread_error = thread->RemoveWatchpoint(addr); if (thread_error.Fail()) { - // Keep track of the first thread error if any threads - // fail. We want to try to remove the watchpoint from - // every thread, though, even if one or more have errors. + // Keep track of the first thread error if any threads fail. We want to + // try to remove the watchpoint from every thread, though, even if one or + // more have errors. if (!overall_error.Fail()) overall_error = thread_error; } @@ -226,9 +224,9 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr, size_t size) { - // This default implementation assumes setting a hardware breakpoint for - // this process will require setting same hardware breakpoint for each - // of its existing threads. New thread will do the same once created. + // This default implementation assumes setting a hardware breakpoint for this + // process will require setting same hardware breakpoint for each of its + // existing threads. New thread will do the same once created. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Update the thread list @@ -254,13 +252,13 @@ Status thread_error = thread->SetHardwareBreakpoint(addr, size); if (thread_error.Success()) { - // Remember that we set this breakpoint successfully in - // case we need to clear it later. + // Remember that we set this breakpoint successfully in case we need to + // clear it later. breakpoint_established_threads.push_back(thread.get()); } else { - // Unset the breakpoint for each thread we successfully - // set so that we get back to a consistent state of "not - // set" for this hardware breakpoint. + // Unset the breakpoint for each thread we successfully set so that we + // get back to a consistent state of "not set" for this hardware + // breakpoint. for (auto rollback_thread_sp : breakpoint_established_threads) { Status remove_error = rollback_thread_sp->RemoveHardwareBreakpoint(addr); @@ -320,8 +318,8 @@ remove(m_delegates.begin(), m_delegates.end(), &native_delegate), m_delegates.end()); - // We removed the delegate if the count of delegates shrank after - // removing all copies of the given native_delegate from the vector. + // We removed the delegate if the count of delegates shrank after removing + // all copies of the given native_delegate from the vector. return m_delegates.size() < initial_size; } @@ -410,8 +408,8 @@ // Give process a chance to do any stop id bump processing, such as // clearing cached data that is invalidated each time the process runs. - // Note if/when we support some threads running, we'll end up needing - // to manage this per thread and per process. + // Note if/when we support some threads running, we'll end up needing to + // manage this per thread and per process. DoStopIDBumped(m_stop_id); } Index: lldb/trunk/source/Host/common/NativeRegisterContext.cpp =================================================================== --- lldb/trunk/source/Host/common/NativeRegisterContext.cpp +++ lldb/trunk/source/Host/common/NativeRegisterContext.cpp @@ -28,13 +28,12 @@ NativeRegisterContext::~NativeRegisterContext() {} // FIXME revisit invalidation, process stop ids, etc. Right now we don't -// support caching in NativeRegisterContext. We can do this later by -// utilizing NativeProcessProtocol::GetStopID () and adding a stop id to +// support caching in NativeRegisterContext. We can do this later by utilizing +// NativeProcessProtocol::GetStopID () and adding a stop id to // NativeRegisterContext. // void -// NativeRegisterContext::InvalidateIfNeeded (bool force) -// { +// NativeRegisterContext::InvalidateIfNeeded (bool force) { // ProcessSP process_sp (m_thread.GetProcess()); // bool invalidate = force; // uint32_t process_stop_id = UINT32_MAX; @@ -365,8 +364,8 @@ // We now have a memory buffer that contains the part or all of the register // value. Set the register value using this memory data. // TODO: we might need to add a parameter to this function in case the byte - // order of the memory data doesn't match the process. For now we are assuming - // they are the same. + // order of the memory data doesn't match the process. For now we are + // assuming they are the same. reg_value.SetFromMemoryData(reg_info, src, src_len, process.GetByteOrder(), error); @@ -385,8 +384,7 @@ // TODO: we might need to add a parameter to this function in case the byte // order of the memory data doesn't match the process. For now we are - // assuming - // they are the same. + // assuming they are the same. const size_t bytes_copied = reg_value.GetAsMemoryData( reg_info, dst, dst_len, process.GetByteOrder(), error); Index: lldb/trunk/source/Host/common/PseudoTerminal.cpp =================================================================== --- lldb/trunk/source/Host/common/PseudoTerminal.cpp +++ lldb/trunk/source/Host/common/PseudoTerminal.cpp @@ -35,10 +35,10 @@ //---------------------------------------------------------------------- // Destructor // -// The destructor will close the master and slave file descriptors -// if they are valid and ownership has not been released using the -// ReleaseMasterFileDescriptor() or the ReleaseSaveFileDescriptor() -// member functions. +// The destructor will close the master and slave file descriptors if they are +// valid and ownership has not been released using the +// ReleaseMasterFileDescriptor() or the ReleaseSaveFileDescriptor() member +// functions. //---------------------------------------------------------------------- PseudoTerminal::~PseudoTerminal() { CloseMasterFileDescriptor(); @@ -66,15 +66,14 @@ } //---------------------------------------------------------------------- -// Open the first available pseudo terminal with OFLAG as the -// permissions. The file descriptor is stored in this object and can -// be accessed with the MasterFileDescriptor() accessor. The -// ownership of the master file descriptor can be released using -// the ReleaseMasterFileDescriptor() accessor. If this object has -// a valid master files descriptor when its destructor is called, it -// will close the master file descriptor, therefore clients must -// call ReleaseMasterFileDescriptor() if they wish to use the master -// file descriptor after this object is out of scope or destroyed. +// Open the first available pseudo terminal with OFLAG as the permissions. The +// file descriptor is stored in this object and can be accessed with the +// MasterFileDescriptor() accessor. The ownership of the master file descriptor +// can be released using the ReleaseMasterFileDescriptor() accessor. If this +// object has a valid master files descriptor when its destructor is called, it +// will close the master file descriptor, therefore clients must call +// ReleaseMasterFileDescriptor() if they wish to use the master file descriptor +// after this object is out of scope or destroyed. // // RETURNS: // True when successful, false indicating an error occurred. @@ -118,12 +117,12 @@ } //---------------------------------------------------------------------- -// Open the slave pseudo terminal for the current master pseudo -// terminal. A master pseudo terminal should already be valid prior to -// calling this function (see OpenFirstAvailableMaster()). -// The file descriptor is stored this object's member variables and can -// be accessed via the GetSlaveFileDescriptor(), or released using the -// ReleaseSlaveFileDescriptor() member function. +// Open the slave pseudo terminal for the current master pseudo terminal. A +// master pseudo terminal should already be valid prior to calling this +// function (see OpenFirstAvailableMaster()). The file descriptor is stored +// this object's member variables and can be accessed via the +// GetSlaveFileDescriptor(), or released using the ReleaseSlaveFileDescriptor() +// member function. // // RETURNS: // True when successful, false indicating an error occurred. @@ -152,8 +151,8 @@ } //---------------------------------------------------------------------- -// Get the name of the slave pseudo terminal. A master pseudo terminal -// should already be valid prior to calling this function (see +// Get the name of the slave pseudo terminal. A master pseudo terminal should +// already be valid prior to calling this function (see // OpenFirstAvailableMaster()). // // RETURNS: @@ -185,18 +184,16 @@ // Fork a child process and have its stdio routed to a pseudo terminal. // // In the parent process when a valid pid is returned, the master file -// descriptor can be used as a read/write access to stdio of the -// child process. +// descriptor can be used as a read/write access to stdio of the child process. // -// In the child process the stdin/stdout/stderr will already be routed -// to the slave pseudo terminal and the master file descriptor will be -// closed as it is no longer needed by the child process. -// -// This class will close the file descriptors for the master/slave -// when the destructor is called, so be sure to call -// ReleaseMasterFileDescriptor() or ReleaseSlaveFileDescriptor() if any -// file descriptors are going to be used past the lifespan of this -// object. +// In the child process the stdin/stdout/stderr will already be routed to the +// slave pseudo terminal and the master file descriptor will be closed as it is +// no longer needed by the child process. +// +// This class will close the file descriptors for the master/slave when the +// destructor is called, so be sure to call ReleaseMasterFileDescriptor() or +// ReleaseSlaveFileDescriptor() if any file descriptors are going to be used +// past the lifespan of this object. // // RETURNS: // in the parent process: the pid of the child, or -1 if fork fails @@ -261,49 +258,47 @@ } //---------------------------------------------------------------------- -// The master file descriptor accessor. This object retains ownership -// of the master file descriptor when this accessor is used. Use -// ReleaseMasterFileDescriptor() if you wish this object to release -// ownership of the master file descriptor. +// The master file descriptor accessor. This object retains ownership of the +// master file descriptor when this accessor is used. Use +// ReleaseMasterFileDescriptor() if you wish this object to release ownership +// of the master file descriptor. // -// Returns the master file descriptor, or -1 if the master file -// descriptor is not currently valid. +// Returns the master file descriptor, or -1 if the master file descriptor is +// not currently valid. //---------------------------------------------------------------------- int PseudoTerminal::GetMasterFileDescriptor() const { return m_master_fd; } //---------------------------------------------------------------------- // The slave file descriptor accessor. // -// Returns the slave file descriptor, or -1 if the slave file -// descriptor is not currently valid. +// Returns the slave file descriptor, or -1 if the slave file descriptor is not +// currently valid. //---------------------------------------------------------------------- int PseudoTerminal::GetSlaveFileDescriptor() const { return m_slave_fd; } //---------------------------------------------------------------------- -// Release ownership of the master pseudo terminal file descriptor -// without closing it. The destructor for this class will close the -// master file descriptor if the ownership isn't released using this -// call and the master file descriptor has been opened. +// Release ownership of the master pseudo terminal file descriptor without +// closing it. The destructor for this class will close the master file +// descriptor if the ownership isn't released using this call and the master +// file descriptor has been opened. //---------------------------------------------------------------------- int PseudoTerminal::ReleaseMasterFileDescriptor() { - // Release ownership of the master pseudo terminal file - // descriptor without closing it. (the destructor for this - // class will close it otherwise!) + // Release ownership of the master pseudo terminal file descriptor without + // closing it. (the destructor for this class will close it otherwise!) int fd = m_master_fd; m_master_fd = invalid_fd; return fd; } //---------------------------------------------------------------------- -// Release ownership of the slave pseudo terminal file descriptor -// without closing it. The destructor for this class will close the -// slave file descriptor if the ownership isn't released using this -// call and the slave file descriptor has been opened. +// Release ownership of the slave pseudo terminal file descriptor without +// closing it. The destructor for this class will close the slave file +// descriptor if the ownership isn't released using this call and the slave +// file descriptor has been opened. //---------------------------------------------------------------------- int PseudoTerminal::ReleaseSlaveFileDescriptor() { - // Release ownership of the slave pseudo terminal file - // descriptor without closing it (the destructor for this - // class will close it otherwise!) + // Release ownership of the slave pseudo terminal file descriptor without + // closing it (the destructor for this class will close it otherwise!) int fd = m_slave_fd; m_slave_fd = invalid_fd; return fd; Index: lldb/trunk/source/Host/common/Socket.cpp =================================================================== --- lldb/trunk/source/Host/common/Socket.cpp +++ lldb/trunk/source/Host/common/Socket.cpp @@ -160,18 +160,17 @@ error = listen_socket->Listen(host_and_port, backlog); if (error.Success()) { - // We were asked to listen on port zero which means we - // must now read the actual port that was given to us - // as port zero is a special code for "find an open port - // for me". + // We were asked to listen on port zero which means we must now read the + // actual port that was given to us as port zero is a special code for + // "find an open port for me". if (port == 0) port = listen_socket->GetLocalPortNumber(); - // Set the port predicate since when doing a listen://: - // it often needs to accept the incoming connection which is a blocking - // system call. Allowing access to the bound port using a predicate allows - // us to wait for the port predicate to be set to a non-zero value from - // another thread in an efficient manor. + // Set the port predicate since when doing a listen://: it + // often needs to accept the incoming connection which is a blocking system + // call. Allowing access to the bound port using a predicate allows us to + // wait for the port predicate to be set to a non-zero value from another + // thread in an efficient manor. if (predicate) predicate->SetValue(port, eBroadcastAlways); socket = listen_socket.release(); @@ -282,8 +281,7 @@ } // If this was unsuccessful, then check if it's simply a signed 32-bit - // integer, representing - // a port with an empty host. + // integer, representing a port with an empty host. host_str.clear(); port_str.clear(); bool ok = false; @@ -436,8 +434,8 @@ error.Clear(); #if defined(ANDROID_USE_ACCEPT_WORKAROUND) // Hack: - // This enables static linking lldb-server to an API 21 libc, but still having - // it run on older devices. It is necessary because API 21 libc's + // This enables static linking lldb-server to an API 21 libc, but still + // having it run on older devices. It is necessary because API 21 libc's // implementation of accept() uses the accept4 syscall(), which is not // available in older kernels. Using an older libc would fix this issue, but // introduce other ones, as the old libraries were quite buggy. Index: lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp =================================================================== --- lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp +++ lldb/trunk/source/Host/common/SoftwareBreakpoint.cpp @@ -17,9 +17,8 @@ using namespace lldb_private; -// ------------------------------------------------------------------- -// static members -// ------------------------------------------------------------------- +// ------------------------------------------------------------------- static +// members ------------------------------------------------------------------- Status SoftwareBreakpoint::CreateSoftwareBreakpoint( NativeProcessProtocol &process, lldb::addr_t addr, size_t size_hint, @@ -34,8 +33,7 @@ __FUNCTION__); // Ask the NativeProcessProtocol subclass to fill in the correct software - // breakpoint - // trap for the breakpoint site. + // breakpoint trap for the breakpoint site. size_t bp_opcode_size = 0; const uint8_t *bp_opcode_bytes = NULL; Status error = process.GetSoftwareBreakpointTrapOpcode( @@ -98,9 +96,8 @@ log->Printf("SoftwareBreakpoint::%s addr = 0x%" PRIx64 " -- SUCCESS", __FUNCTION__, addr); - // Set the breakpoint and verified it was written properly. Now - // create a breakpoint remover that understands how to undo this - // breakpoint. + // Set the breakpoint and verified it was written properly. Now create a + // breakpoint remover that understands how to undo this breakpoint. breakpoint_sp.reset(new SoftwareBreakpoint(process, addr, saved_opcode_bytes, bp_opcode_bytes, bp_opcode_size)); return Status(); @@ -280,8 +277,8 @@ // Make sure the breakpoint opcode exists at this address if (::memcmp(curr_break_op, m_trap_opcodes, m_opcode_size) == 0) { break_op_found = true; - // We found a valid breakpoint opcode at this address, now restore - // the saved opcode. + // We found a valid breakpoint opcode at this address, now restore the + // saved opcode. size_t bytes_written = 0; error = m_process.WriteMemory(m_addr, m_saved_opcodes, m_opcode_size, bytes_written); Index: lldb/trunk/source/Host/common/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -111,15 +111,15 @@ // Add a ".dSYM" name to each directory component of the path, // stripping off components. e.g. we may have a binary like - // /S/L/F/Foundation.framework/Versions/A/Foundation - // and + // /S/L/F/Foundation.framework/Versions/A/Foundation and // /S/L/F/Foundation.framework.dSYM // - // so we'll need to start with /S/L/F/Foundation.framework/Versions/A, - // add the .dSYM part to the "A", and if that doesn't exist, strip off - // the "A" and try it again with "Versions", etc., until we find a - // dSYM bundle or we've stripped off enough path components that - // there's no need to continue. + // so we'll need to start with + // /S/L/F/Foundation.framework/Versions/A, add the .dSYM part to the + // "A", and if that doesn't exist, strip off the "A" and try it again + // with "Versions", etc., until we find a dSYM bundle or we've + // stripped off enough path components that there's no need to + // continue. for (int i = 0; i < 4; i++) { // Does this part of the path have a "." character - could it be a @@ -131,7 +131,8 @@ dsym_fspec = parent_dirs; dsym_fspec.RemoveLastPathComponent(); - // If the current directory name is "Foundation.framework", see if + // If the current directory name is "Foundation.framework", see + // if // "Foundation.framework.dSYM/Contents/Resources/DWARF/Foundation" // exists & has the right uuid. std::string dsym_fn = fn; @@ -293,10 +294,9 @@ if (num_specs == 1) { ModuleSpec mspec; if (specs.GetModuleSpecAtIndex(0, mspec)) { - // Skip the uuids check if module_uuid is invalid. - // For example, this happens for *.dwp files since - // at the moment llvm-dwp doesn't output build ids, - // nor does binutils dwp. + // Skip the uuids check if module_uuid is invalid. For example, + // this happens for *.dwp files since at the moment llvm-dwp + // doesn't output build ids, nor does binutils dwp. if (!module_uuid.IsValid() || module_uuid == mspec.GetUUID()) return file_spec; } Index: lldb/trunk/source/Host/common/TaskPool.cpp =================================================================== --- lldb/trunk/source/Host/common/TaskPool.cpp +++ lldb/trunk/source/Host/common/TaskPool.cpp @@ -49,8 +49,8 @@ TaskPoolImpl::TaskPoolImpl() : m_thread_count(0) {} unsigned GetHardwareConcurrencyHint() { - // std::thread::hardware_concurrency may return 0 - // if the value is not well defined or not computable. + // std::thread::hardware_concurrency may return 0 if the value is not well + // defined or not computable. static const unsigned g_hardware_concurrency = std::max(1u, std::thread::hardware_concurrency()); return g_hardware_concurrency; @@ -64,9 +64,8 @@ if (m_thread_count < GetHardwareConcurrencyHint()) { m_thread_count++; // Note that this detach call needs to happen with the m_tasks_mutex held. - // This prevents the thread - // from exiting prematurely and triggering a linux libc bug - // (https://sourceware.org/bugzilla/show_bug.cgi?id=19951). + // This prevents the thread from exiting prematurely and triggering a linux + // libc bug (https://sourceware.org/bugzilla/show_bug.cgi?id=19951). lldb_private::ThreadLauncher::LaunchThread("task-pool.worker", WorkerPtr, this, nullptr, min_stack_size) .Release(); Index: lldb/trunk/source/Host/common/Terminal.cpp =================================================================== --- lldb/trunk/source/Host/common/Terminal.cpp +++ lldb/trunk/source/Host/common/Terminal.cpp @@ -107,9 +107,9 @@ } //---------------------------------------------------------------------- -// Save the current state of the TTY for the file descriptor "fd" -// and if "save_process_group" is true, attempt to save the process -// group info for the TTY. +// Save the current state of the TTY for the file descriptor "fd" and if +// "save_process_group" is true, attempt to save the process group info for the +// TTY. //---------------------------------------------------------------------- bool TerminalState::Save(int fd, bool save_process_group) { m_tty.SetFileDescriptor(fd); @@ -142,8 +142,8 @@ } //---------------------------------------------------------------------- -// Restore the state of the TTY using the cached values from a -// previous call to Save(). +// Restore the state of the TTY using the cached values from a previous call to +// Save(). //---------------------------------------------------------------------- bool TerminalState::Restore() const { #ifndef LLDB_DISABLE_POSIX @@ -173,8 +173,8 @@ } //---------------------------------------------------------------------- -// Returns true if this object has valid saved TTY state settings -// that can be used to restore a previous state. +// Returns true if this object has valid saved TTY state settings that can be +// used to restore a previous state. //---------------------------------------------------------------------- bool TerminalState::IsValid() const { return m_tty.FileDescriptorIsValid() && @@ -236,21 +236,20 @@ m_ttystates[idx].IsValid()) return true; - // Set the state to match the index passed in and only update the - // current state if there are no errors. + // Set the state to match the index passed in and only update the current + // state if there are no errors. if (m_ttystates[idx].Restore()) { m_currentState = idx; return true; } - // We failed to set the state. The tty state was invalid or not - // initialized. + // We failed to set the state. The tty state was invalid or not initialized. return false; } //------------------------------------------------------------------ -// Save the state at index "idx" for file descriptor "fd" and -// save the process group if requested. +// Save the state at index "idx" for file descriptor "fd" and save the process +// group if requested. // // Returns true if the restore was successful, false otherwise. //------------------------------------------------------------------ Index: lldb/trunk/source/Host/common/UDPSocket.cpp =================================================================== --- lldb/trunk/source/Host/common/UDPSocket.cpp +++ lldb/trunk/source/Host/common/UDPSocket.cpp @@ -69,8 +69,8 @@ if (!DecodeHostAndPort(name, host_str, port_str, port, &error)) return error; - // At this point we have setup the receive port, now we need to - // setup the UDP send socket + // At this point we have setup the receive port, now we need to setup the UDP + // send socket struct addrinfo hints; struct addrinfo *service_info_list = nullptr; Index: lldb/trunk/source/Host/common/XML.cpp =================================================================== --- lldb/trunk/source/Host/common/XML.cpp +++ lldb/trunk/source/Host/common/XML.cpp @@ -252,8 +252,8 @@ if (node->type != XML_ELEMENT_NODE) continue; - // If name is nullptr, we take all nodes of type "t", else - // just the ones whose name matches + // If name is nullptr, we take all nodes of type "t", else just the ones + // whose name matches if (name) { if (strcmp((const char *)node->name, name) != 0) continue; // Name mismatch, ignore this one Index: lldb/trunk/source/Host/freebsd/Host.cpp =================================================================== --- lldb/trunk/source/Host/freebsd/Host.cpp +++ lldb/trunk/source/Host/freebsd/Host.cpp @@ -192,9 +192,8 @@ continue; // Every thread is a process in FreeBSD, but all the threads of a single - // process have the same pid. Do not store the process info in the - // result list if a process with given identifier is already registered - // there. + // process have the same pid. Do not store the process info in the result + // list if a process with given identifier is already registered there. bool already_registered = false; for (uint32_t pi = 0; !already_registered && (const int)kinfo.ki_numthreads > 1 && Index: lldb/trunk/source/Host/linux/Host.cpp =================================================================== --- lldb/trunk/source/Host/linux/Host.cpp +++ lldb/trunk/source/Host/linux/Host.cpp @@ -246,8 +246,8 @@ if (State == ProcessState::Zombie) continue; - // Check for user match if we're not matching all users and not running as - // root. + // Check for user match if we're not matching all users and not running + // as root. if (!all_users && (our_uid != 0) && (process_info.GetUserID() != our_uid)) continue; Index: lldb/trunk/source/Host/linux/HostInfoLinux.cpp =================================================================== --- lldb/trunk/source/Host/linux/HostInfoLinux.cpp +++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp @@ -57,8 +57,7 @@ success = true; else { // Some kernels omit the update version, so try looking for just "X.Y" - // and - // set update to 0. + // and set update to 0. g_fields->m_os_update = 0; status = sscanf(un.release, "%u.%u", &g_fields->m_os_major, &g_fields->m_os_minor); @@ -100,8 +99,8 @@ } llvm::StringRef HostInfoLinux::GetDistributionId() { - // Try to run 'lbs_release -i', and use that response - // for the distribution id. + // Try to run 'lbs_release -i', and use that response for the distribution + // id. static llvm::once_flag g_once_flag; llvm::call_once(g_once_flag, []() { @@ -109,8 +108,7 @@ if (log) log->Printf("attempting to determine Linux distribution..."); - // check if the lsb_release command exists at one of the - // following paths + // check if the lsb_release command exists at one of the following paths const char *const exe_paths[] = {"/bin/lsb_release", "/usr/bin/lsb_release"}; @@ -212,8 +210,8 @@ bool HostInfoLinux::ComputeUserPluginsDirectory(FileSpec &file_spec) { // XDG Base Directory Specification - // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html - // If XDG_DATA_HOME exists, use that, otherwise use ~/.local/share/lldb. + // http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html If + // XDG_DATA_HOME exists, use that, otherwise use ~/.local/share/lldb. const char *xdg_data_home = getenv("XDG_DATA_HOME"); if (xdg_data_home && xdg_data_home[0]) { std::string user_plugin_dir(xdg_data_home); Index: lldb/trunk/source/Host/macosx/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/macosx/Symbols.cpp +++ lldb/trunk/source/Host/macosx/Symbols.cpp @@ -340,9 +340,8 @@ std::string DBGBuildSourcePath; std::string DBGSourcePath; - // If DBGVersion value 2 or higher, look for - // DBGSourcePathRemapping dictionary and append the key-value pairs - // to our remappings. + // If DBGVersion value 2 or higher, look for DBGSourcePathRemapping + // dictionary and append the key-value pairs to our remappings. cf_dict = (CFDictionaryRef)CFDictionaryGetValue( (CFDictionaryRef)uuid_dict, CFSTR("DBGSourcePathRemapping")); if (cf_dict && CFGetTypeID(cf_dict) == CFDictionaryGetTypeID()) { @@ -389,10 +388,9 @@ } if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) { // In the "old style" DBGSourcePathRemapping dictionary, the - // DBGSourcePath values - // (the "values" half of key-value path pairs) were wrong. Ignore - // them and use the - // universal DBGSourcePath string from earlier. + // DBGSourcePath values (the "values" half of key-value path pairs) + // were wrong. Ignore them and use the universal DBGSourcePath + // string from earlier. if (new_style_source_remapping_dictionary == true && !original_DBGSourcePath_value.empty()) { DBGSourcePath = original_DBGSourcePath_value; @@ -402,9 +400,9 @@ DBGSourcePath = resolved_source_path.GetPath(); } // With version 2 of DBGSourcePathRemapping, we can chop off the - // last two filename parts from the source remapping and get a - // more general source remapping that still works. Add this as - // another option in addition to the full source path remap. + // last two filename parts from the source remapping and get a more + // general source remapping that still works. Add this as another + // option in addition to the full source path remap. module_spec.GetSourceMappingList().Append( ConstString(DBGBuildSourcePath.c_str()), ConstString(DBGSourcePath.c_str()), true); @@ -429,8 +427,8 @@ } - // If we have a DBGBuildSourcePath + DBGSourcePath pair, - // append them to the source remappings list. + // If we have a DBGBuildSourcePath + DBGSourcePath pair, append them to the + // source remappings list. cf_str = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)uuid_dict, CFSTR("DBGBuildSourcePath")); @@ -464,8 +462,7 @@ const FileSpec *file_spec_ptr = module_spec.GetFileSpecPtr(); // It's expensive to check for the DBGShellCommands defaults setting, only do - // it once per - // lldb run and cache the result. + // it once per lldb run and cache the result. static bool g_have_checked_for_dbgshell_command = false; static const char *g_dbgshell_command = NULL; if (g_have_checked_for_dbgshell_command == false) { @@ -487,8 +484,7 @@ } // When g_dbgshell_command is NULL, the user has not enabled the use of an - // external program - // to find the symbols, don't run it for them. + // external program to find the symbols, don't run it for them. if (force_lookup == false && g_dbgshell_command == NULL) { return false; } Index: lldb/trunk/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp =================================================================== --- lldb/trunk/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp +++ lldb/trunk/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp @@ -352,9 +352,8 @@ CFMutableDictionaryRef dict = Dictionary(can_create); if (dict != NULL) { // The number may appear negative if the MSBit is set in "value". Due to a - // limitation of - // CFNumber, there isn't a way to have it show up otherwise as of this - // writing. + // limitation of CFNumber, there isn't a way to have it show up otherwise + // as of this writing. CFCReleaser cf_number( ::CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value)); if (cf_number.get()) { @@ -371,9 +370,8 @@ CFMutableDictionaryRef dict = Dictionary(can_create); if (dict != NULL) { // The number may appear negative if the MSBit is set in "value". Due to a - // limitation of - // CFNumber, there isn't a way to have it show up otherwise as of this - // writing. + // limitation of CFNumber, there isn't a way to have it show up otherwise + // as of this writing. CFCReleaser cf_number( ::CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &value)); if (cf_number.get()) { @@ -390,9 +388,8 @@ CFMutableDictionaryRef dict = Dictionary(can_create); if (dict != NULL) { // The number may appear negative if the MSBit is set in "value". Due to a - // limitation of - // CFNumber, there isn't a way to have it show up otherwise as of this - // writing. + // limitation of CFNumber, there isn't a way to have it show up otherwise + // as of this writing. CFCReleaser cf_number( ::CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &value)); if (cf_number.get()) { @@ -409,9 +406,8 @@ CFMutableDictionaryRef dict = Dictionary(can_create); if (dict != NULL) { // The number may appear negative if the MSBit is set in "value". Due to a - // limitation of - // CFNumber, there isn't a way to have it show up otherwise as of this - // writing. + // limitation of CFNumber, there isn't a way to have it show up otherwise + // as of this writing. CFCReleaser cf_number( ::CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &value)); if (cf_number.get()) { Index: lldb/trunk/source/Host/macosx/cfcpp/CFCString.cpp =================================================================== --- lldb/trunk/source/Host/macosx/cfcpp/CFCString.cpp +++ lldb/trunk/source/Host/macosx/cfcpp/CFCString.cpp @@ -88,9 +88,8 @@ return CFCString::UTF8(get(), str); } -// Static function that puts a copy of the UTF8 contents of CF_STR into STR -// and returns the C string pointer that is contained in STR when successful, -// else +// Static function that puts a copy of the UTF8 contents of CF_STR into STR and +// returns the C string pointer that is contained in STR when successful, else // NULL is returned. This allows the std::string parameter to own the extracted // string, // and also allows that string to be returned as a C string pointer that can be @@ -129,9 +128,9 @@ // Static function that puts a copy of the file system representation of CF_STR // into STR and returns the C string pointer that is contained in STR when -// successful, else NULL is returned. This allows the std::string parameter -// to own the extracted string, and also allows that string to be returned as -// a C string pointer that can be used. +// successful, else NULL is returned. This allows the std::string parameter to +// own the extracted string, and also allows that string to be returned as a C +// string pointer that can be used. const char *CFCString::FileSystemRepresentation(CFStringRef cf_str, std::string &str) { Index: lldb/trunk/source/Host/netbsd/Host.cpp =================================================================== --- lldb/trunk/source/Host/netbsd/Host.cpp +++ lldb/trunk/source/Host/netbsd/Host.cpp @@ -192,9 +192,8 @@ continue; // Every thread is a process in NetBSD, but all the threads of a single - // process have the same pid. Do not store the process info in the - // result list if a process with given identifier is already registered - // there. + // process have the same pid. Do not store the process info in the result + // list if a process with given identifier is already registered there. if (proc_kinfo[i].p_nlwps > 1) { bool already_registered = false; for (size_t pi = 0; pi < process_infos.GetSize(); pi++) { Index: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp =================================================================== --- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -189,15 +189,14 @@ } #ifndef LLDB_DISABLE_POSIX else if ((addr = GetURLAddress(path, FD_SCHEME))) { - // Just passing a native file descriptor within this current process - // that is already opened (possibly from a service or other source). + // Just passing a native file descriptor within this current process that + // is already opened (possibly from a service or other source). int fd = -1; if (!addr->getAsInteger(0, fd)) { - // We have what looks to be a valid file descriptor, but we - // should make sure it is. We currently are doing this by trying to - // get the flags from the file descriptor and making sure it - // isn't a bad fd. + // We have what looks to be a valid file descriptor, but we should make + // sure it is. We currently are doing this by trying to get the flags + // from the file descriptor and making sure it isn't a bad fd. errno = 0; int flags = ::fcntl(fd, F_GETFL, 0); if (flags == -1 || errno == EBADF) { @@ -208,20 +207,18 @@ m_write_sp.reset(); return eConnectionStatusError; } else { - // Don't take ownership of a file descriptor that gets passed - // to us since someone else opened the file descriptor and - // handed it to us. + // Don't take ownership of a file descriptor that gets passed to us + // since someone else opened the file descriptor and handed it to us. // TODO: Since are using a URL to open connection we should - // eventually parse options using the web standard where we - // have "fd://123?opt1=value;opt2=value" and we can have an - // option be "owns=1" or "owns=0" or something like this to - // allow us to specify this. For now, we assume we must - // assume we don't own it. + // eventually parse options using the web standard where we have + // "fd://123?opt1=value;opt2=value" and we can have an option be + // "owns=1" or "owns=0" or something like this to allow us to specify + // this. For now, we assume we must assume we don't own it. std::unique_ptr tcp_socket; tcp_socket.reset(new TCPSocket(fd, false, false)); - // Try and get a socket option from this file descriptor to - // see if this is a socket and set m_is_socket accordingly. + // Try and get a socket option from this file descriptor to see if + // this is a socket and set m_is_socket accordingly. int resuse; bool is_socket = !!tcp_socket->GetOption(SOL_SOCKET, SO_REUSEADDR, resuse); @@ -320,13 +317,11 @@ m_read_sp->GetFdType() == IOObject::eFDTypeSocket) static_cast(*m_read_sp).PreDisconnect(); - // 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. + // 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; @@ -430,11 +425,11 @@ case EINVAL: // The pointer associated with fildes was negative. case EIO: // An I/O error occurred while reading from the file system. // The process group is orphaned. - // The file is a regular file, nbyte is greater than 0, - // the starting position is before the end-of-file, and - // the starting position is greater than or equal to the - // offset maximum established for the open file - // descriptor associated with fildes. + // The file is a regular file, nbyte is greater than 0, the + // starting position is before the end-of-file, and the + // starting position is greater than or equal to the offset + // maximum established for the open file descriptor + // associated with fildes. case EISDIR: // An attempt is made to read a directory. case ENOBUFS: // An attempt to allocate a memory buffer fails. case ENOMEM: // Insufficient memory is available. @@ -550,15 +545,15 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout &timeout, Status *error_ptr) { // 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. + // Read. If we ever get used more generally we will need to lock here as + // well. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_CONNECTION)); LLDB_LOG(log, "this = {0}, timeout = {1}", this, timeout); - // 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() + // 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 IOObject::WaitableHandle handle = m_read_sp->GetWaitableHandle(); const int pipe_fd = m_pipe.GetReadFileDescriptor(); @@ -570,10 +565,9 @@ select_helper.FDSetRead(handle); #if defined(_MSC_VER) // select() won't accept pipes on Windows. The entire Windows codepath - // needs to be - // converted over to using WaitForMultipleObjects and event HANDLEs, but for - // now at least - // this will allow ::select() to not return an error. + // needs to be converted over to using WaitForMultipleObjects and event + // HANDLEs, but for now at least this will allow ::select() to not return + // an error. const bool have_pipe_fd = false; #else const bool have_pipe_fd = pipe_fd >= 0; @@ -603,11 +597,10 @@ return eConnectionStatusTimedOut; case EAGAIN: // The kernel was (perhaps temporarily) unable to - // allocate the requested number of file descriptors, - // or we have non-blocking IO + // allocate the requested number of file descriptors, or + // we have non-blocking IO case EINTR: // A signal was delivered before the time limit - // expired and before any of the selected events - // occurred. + // expired and before any of the selected events occurred. break; // Lets keep reading to until we timeout } } else { @@ -615,8 +608,8 @@ return eConnectionStatusSuccess; if (select_helper.FDIsSetRead(pipe_fd)) { - // There is an interrupt or exit command in the command pipe - // Read the data from that pipe: + // There is an interrupt or exit command in the command pipe Read the + // data from that pipe: char c; ssize_t bytes_read = llvm::sys::RetryAfterSignal(-1, ::read, pipe_fd, &c, 1); Index: lldb/trunk/source/Host/posix/HostInfoPosix.cpp =================================================================== --- lldb/trunk/source/Host/posix/HostInfoPosix.cpp +++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp @@ -103,8 +103,7 @@ } } else { // The threadsafe version isn't currently working for me on darwin, but the - // non-threadsafe version - // is, so I am calling it below. + // non-threadsafe version is, so I am calling it below. group_info_ptr = ::getgrgid(gid); if (group_info_ptr) { group_name.assign(group_info_ptr->gr_name); @@ -141,8 +140,8 @@ llvm::StringRef parent_path = llvm::sys::path::parent_path(raw_path); // Most Posix systems (e.g. Linux/*BSD) will attempt to replace a */lib with - // */bin as the base directory for helper exe programs. This will fail if the - // /lib and /bin directories are rooted in entirely different trees. + // */bin as the base directory for helper exe programs. This will fail if + // the /lib and /bin directories are rooted in entirely different trees. if (log) log->Printf("HostInfoPosix::ComputePathRelativeToLibrary() attempting to " "derive the %s path from this path: %s", @@ -192,9 +191,9 @@ lldb_file_spec.GetPath(raw_path, sizeof(raw_path)); #if defined(LLDB_PYTHON_RELATIVE_LIBDIR) - // Build the path by backing out of the lib dir, then building - // with whatever the real python interpreter uses. (e.g. lib - // for most, lib64 on RHEL x86_64). + // Build the path by backing out of the lib dir, then building with whatever + // the real python interpreter uses. (e.g. lib for most, lib64 on RHEL + // x86_64). char python_path[PATH_MAX]; ::snprintf(python_path, sizeof(python_path), "%s/../%s", raw_path, LLDB_PYTHON_RELATIVE_LIBDIR); Index: lldb/trunk/source/Host/posix/PipePosix.cpp =================================================================== --- lldb/trunk/source/Host/posix/PipePosix.cpp +++ lldb/trunk/source/Host/posix/PipePosix.cpp @@ -137,8 +137,8 @@ } // It's possible that another process creates the target path after we've - // verified it's available but before we create it, in which case we - // should try again. + // verified it's available but before we create it, in which case we should + // try again. Status error; do { llvm::sys::fs::createUniqueFile(tmpdir_file_spec.GetPath(), Index: lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp =================================================================== --- lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp +++ lldb/trunk/source/Host/posix/ProcessLauncherPosixFork.cpp @@ -131,8 +131,8 @@ FixupEnvironment(env); Environment::Envp envp = env.getEnvp(); - // Clear the signal mask to prevent the child from being affected by - // any masking done by the parent. + // Clear the signal mask to prevent the child from being affected by any + // masking done by the parent. sigset_t set; if (sigemptyset(&set) != 0 || pthread_sigmask(SIG_SETMASK, &set, nullptr) != 0) @@ -142,8 +142,7 @@ // HACK: // Close everything besides stdin, stdout, and stderr that has no file // action to avoid leaking. Only do this when debugging, as elsewhere we - // actually rely on - // passing open descriptors to child processes. + // actually rely on passing open descriptors to child processes. for (int fd = 3; fd < sysconf(_SC_OPEN_MAX); ++fd) if (!info.GetFileActionForFD(fd) && fd != error_fd) close(fd); @@ -158,18 +157,14 @@ #if defined(__linux__) if (errno == ETXTBSY) { - // On android M and earlier we can get this error because the adb deamon can - // hold a write - // handle on the executable even after it has finished uploading it. This - // state lasts - // only a short time and happens only when there are many concurrent adb - // commands being - // issued, such as when running the test suite. (The file remains open when - // someone does - // an "adb shell" command in the fork() child before it has had a chance to - // exec.) Since - // this state should clear up quickly, wait a while and then give it one - // more go. + // On android M and earlier we can get this error because the adb deamon + // can hold a write handle on the executable even after it has finished + // uploading it. This state lasts only a short time and happens only when + // there are many concurrent adb commands being issued, such as when + // running the test suite. (The file remains open when someone does an "adb + // shell" command in the fork() child before it has had a chance to exec.) + // Since this state should clear up quickly, wait a while and then give it + // one more go. usleep(50000); execve(argv[0], const_cast(argv), envp); } Index: lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp =================================================================== --- lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp +++ lldb/trunk/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -21,12 +21,10 @@ namespace { // This is a simple helper class to package up the information needed to return -// from a Read/Write -// operation function. Since there is a lot of code to be run before exit -// regardless of whether the -// operation succeeded or failed, combined with many possible return paths, this -// is the cleanest -// way to represent it. +// from a Read/Write operation function. Since there is a lot of code to be +// run before exit regardless of whether the operation succeeded or failed, +// combined with many possible return paths, this is the cleanest way to +// represent it. class ReturnInfo { public: void Set(size_t bytes, ConnectionStatus status, DWORD error_code) { @@ -78,11 +76,9 @@ m_event_handles[kInterruptEvent] = CreateEvent(NULL, FALSE, FALSE, NULL); // Note, we should use a manual reset event for the hEvent argument of the - // OVERLAPPED. This - // is because both WaitForMultipleObjects and GetOverlappedResult (if you set - // the bWait - // argument to TRUE) will wait for the event to be signalled. If we use an - // auto-reset event, + // OVERLAPPED. This is because both WaitForMultipleObjects and + // GetOverlappedResult (if you set the bWait argument to TRUE) will wait for + // the event to be signalled. If we use an auto-reset event, // WaitForMultipleObjects will reset the event, return successfully, and then // GetOverlappedResult will block since the event is no longer signalled. m_event_handles[kBytesAvailableEvent] = @@ -147,8 +143,7 @@ return eConnectionStatusSuccess; // Reset the handle so that after we unblock any pending reads, subsequent - // calls to Read() will - // see a disconnected state. + // calls to Read() will see a disconnected state. HANDLE old_file = m_file; m_file = INVALID_HANDLE_VALUE; @@ -157,8 +152,7 @@ ::CancelIoEx(old_file, &m_overlapped); // Close the file handle if we owned it, but don't close the event handles. - // We could always - // reconnect with the same Connection instance. + // We could always reconnect with the same Connection instance. if (m_owns_file) ::CloseHandle(old_file); @@ -190,8 +184,7 @@ if (result || ::GetLastError() == ERROR_IO_PENDING) { if (!result) { // The expected return path. The operation is pending. Wait for the - // operation to complete - // or be interrupted. + // operation to complete or be interrupted. DWORD milliseconds = timeout ? std::chrono::duration_cast(*timeout) @@ -219,11 +212,9 @@ // The data is ready. Figure out how much was read and return; if (!::GetOverlappedResult(m_file, &m_overlapped, &bytes_read, FALSE)) { DWORD result_error = ::GetLastError(); - // ERROR_OPERATION_ABORTED occurs when someone calls Disconnect() during a - // blocking read. - // This triggers a call to CancelIoEx, which causes the operation to - // complete and the - // result to be ERROR_OPERATION_ABORTED. + // ERROR_OPERATION_ABORTED occurs when someone calls Disconnect() during + // a blocking read. This triggers a call to CancelIoEx, which causes the + // operation to complete and the result to be ERROR_OPERATION_ABORTED. if (result_error == ERROR_HANDLE_EOF || result_error == ERROR_OPERATION_ABORTED || result_error == ERROR_BROKEN_PIPE) @@ -250,9 +241,9 @@ if (error_ptr) *error_ptr = return_info.GetError(); - // kBytesAvailableEvent is a manual reset event. Make sure it gets reset here - // so that any - // subsequent operations don't immediately see bytes available. + // kBytesAvailableEvent is a manual reset event. Make sure it gets reset + // here so that any subsequent operations don't immediately see bytes + // available. ResetEvent(m_event_handles[kBytesAvailableEvent]); IncrementFilePointer(return_info.GetBytes()); @@ -284,7 +275,8 @@ m_overlapped.hEvent = NULL; - // Writes are not interruptible like reads are, so just block until it's done. + // Writes are not interruptible like reads are, so just block until it's + // done. result = ::WriteFile(m_file, src, src_len, NULL, &m_overlapped); if (!result && ::GetLastError() != ERROR_IO_PENDING) { return_info.Set(0, eConnectionStatusError, ::GetLastError()); Index: lldb/trunk/source/Host/windows/EditLineWin.cpp =================================================================== --- lldb/trunk/source/Host/windows/EditLineWin.cpp +++ lldb/trunk/source/Host/windows/EditLineWin.cpp @@ -316,8 +316,8 @@ } int el_source(EditLine *el, const char *file) { - // init edit line by reading the contents of 'file' - // nothing to do here on windows... + // init edit line by reading the contents of 'file' nothing to do here on + // windows... return 0; } @@ -342,8 +342,8 @@ } int history(History *, HistEvent *, int op, ...) { - // perform operation 'op' on the history list with - // optional arguments as needed by the operation. + // perform operation 'op' on the history list with optional arguments as + // needed by the operation. return 0; } Index: lldb/trunk/source/Host/windows/Host.cpp =================================================================== --- lldb/trunk/source/Host/windows/Host.cpp +++ lldb/trunk/source/Host/windows/Host.cpp @@ -35,8 +35,7 @@ namespace { bool GetTripleForProcess(const FileSpec &executable, llvm::Triple &triple) { // Open the PE File as a binary file, and parse just enough information to - // determine the - // machine type. + // determine the machine type. File imageBinary(executable.GetPath().c_str(), File::eOpenOptionRead, lldb::eFilePermissionsUserRead); imageBinary.SeekFromStart(0x3c); @@ -63,8 +62,8 @@ } bool GetExecutableForProcess(const AutoHandle &handle, std::string &path) { - // Get the process image path. MAX_PATH isn't long enough, paths can actually - // be up to 32KB. + // Get the process image path. MAX_PATH isn't long enough, paths can + // actually be up to 32KB. std::vector buffer(PATH_MAX); DWORD dwSize = buffer.size(); if (!::QueryFullProcessImageNameW(handle.get(), 0, &buffer[0], &dwSize)) @@ -75,10 +74,9 @@ void GetProcessExecutableAndTriple(const AutoHandle &handle, ProcessInstanceInfo &process) { // We may not have permissions to read the path from the process. So start - // off by - // setting the executable file to whatever Toolhelp32 gives us, and then try - // to - // enhance this with more detailed information, but fail gracefully. + // off by setting the executable file to whatever Toolhelp32 gives us, and + // then try to enhance this with more detailed information, but fail + // gracefully. std::string executable; llvm::Triple triple; triple.setVendor(llvm::Triple::PC); Index: lldb/trunk/source/Host/windows/HostInfoWindows.cpp =================================================================== --- lldb/trunk/source/Host/windows/HostInfoWindows.cpp +++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp @@ -50,11 +50,10 @@ info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); #pragma warning(push) #pragma warning(disable : 4996) - // Starting with Microsoft SDK for Windows 8.1, this function is deprecated in - // favor of the - // new Windows Version Helper APIs. Since we don't specify a minimum SDK - // version, it's easier - // to simply disable the warning rather than try to support both APIs. + // Starting with Microsoft SDK for Windows 8.1, this function is deprecated + // in favor of the new Windows Version Helper APIs. Since we don't specify a + // minimum SDK version, it's easier to simply disable the warning rather than + // try to support both APIs. if (GetVersionEx((LPOSVERSIONINFO)&info) == 0) { return false; } Index: lldb/trunk/source/Host/windows/HostProcessWindows.cpp =================================================================== --- lldb/trunk/source/Host/windows/HostProcessWindows.cpp +++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp @@ -88,8 +88,8 @@ info->callback = callback; // Since the life of this HostProcessWindows instance and the life of the - // process may be different, duplicate the handle so that - // the monitor thread can have ownership over its own copy of the handle. + // process may be different, duplicate the handle so that the monitor thread + // can have ownership over its own copy of the handle. HostThread result; if (::DuplicateHandle(GetCurrentProcess(), m_process, GetCurrentProcess(), &info->process_handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) Index: lldb/trunk/source/Host/windows/PipeWindows.cpp =================================================================== --- lldb/trunk/source/Host/windows/PipeWindows.cpp +++ lldb/trunk/source/Host/windows/PipeWindows.cpp @@ -40,11 +40,9 @@ PipeWindows::~PipeWindows() { Close(); } Status PipeWindows::CreateNew(bool child_process_inherit) { - // Even for anonymous pipes, we open a named pipe. This is because you cannot - // get - // overlapped i/o on Windows without using a named pipe. So we synthesize a - // unique - // name. + // Even for anonymous pipes, we open a named pipe. This is because you + // cannot get overlapped i/o on Windows without using a named pipe. So we + // synthesize a unique name. uint32_t serial = g_pipe_serial.fetch_add(1); std::string pipe_name; llvm::raw_string_ostream pipe_name_stream(pipe_name); @@ -65,8 +63,8 @@ std::string pipe_path = "\\\\.\\Pipe\\"; pipe_path.append(name); - // Always open for overlapped i/o. We implement blocking manually in Read and - // Write. + // Always open for overlapped i/o. We implement blocking manually in Read + // and Write. DWORD read_mode = FILE_FLAG_OVERLAPPED; m_read = ::CreateNamedPipeA( pipe_path.c_str(), PIPE_ACCESS_INBOUND | read_mode, @@ -250,12 +248,10 @@ DWORD wait_result = ::WaitForSingleObject(m_read_overlapped.hEvent, timeout); if (wait_result != WAIT_OBJECT_0) { // The operation probably failed. However, if it timed out, we need to - // cancel the I/O. - // Between the time we returned from WaitForSingleObject and the time we - // call CancelIoEx, - // the operation may complete. If that hapens, CancelIoEx will fail and - // return ERROR_NOT_FOUND. - // If that happens, the original operation should be considered to have been + // cancel the I/O. Between the time we returned from WaitForSingleObject + // and the time we call CancelIoEx, the operation may complete. If that + // hapens, CancelIoEx will fail and return ERROR_NOT_FOUND. If that + // happens, the original operation should be considered to have been // successful. bool failed = true; DWORD failure_error = ::GetLastError(); @@ -268,9 +264,8 @@ return Status(failure_error, eErrorTypeWin32); } - // Now we call GetOverlappedResult setting bWait to false, since we've already - // waited - // as long as we're willing to. + // Now we call GetOverlappedResult setting bWait to false, since we've + // already waited as long as we're willing to. if (!GetOverlappedResult(m_read, &m_read_overlapped, &sys_bytes_read, FALSE)) return Status(::GetLastError(), eErrorTypeWin32); Index: lldb/trunk/source/Interpreter/CommandAlias.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandAlias.cpp +++ lldb/trunk/source/Interpreter/CommandAlias.cpp @@ -196,8 +196,8 @@ } } - // if this is a nested alias, it may be adding arguments on top of an - // already dash-dash alias + // if this is a nested alias, it may be adding arguments on top of an already + // dash-dash alias if ((m_is_dashdash_alias == eLazyBoolNo) && IsNestedAlias()) m_is_dashdash_alias = (GetUnderlyingCommand()->IsDashDashCommand() ? eLazyBoolYes @@ -228,8 +228,7 @@ } // allow CommandAlias objects to provide their own help, but fallback to the -// info -// for the underlying command if no customization has been provided +// info for the underlying command if no customization has been provided void CommandAlias::SetHelp(llvm::StringRef str) { this->CommandObject::SetHelp(str); m_did_set_help = true; Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp @@ -681,10 +681,9 @@ "bt [ | all]", 2, 0, false)); if (bt_regex_cmd_ap.get()) { // accept but don't document "bt -c " -- before bt was a regex - // command if you wanted to backtrace - // three frames you would do "bt -c 3" but the intention is to have this - // emulate the gdb "bt" command and - // so now "bt 3" is the preferred form, in line with gdb. + // command if you wanted to backtrace three frames you would do "bt -c 3" + // but the intention is to have this emulate the gdb "bt" command and so + // now "bt 3" is the preferred form, in line with gdb. if (bt_regex_cmd_ap->AddRegexCommand("^([[:digit:]]+)$", "thread backtrace -c %1") && bt_regex_cmd_ap->AddRegexCommand("^-c ([[:digit:]]+)$", @@ -825,9 +824,8 @@ unsigned int num_user_matches = 0; // Look through the command dictionaries one by one, and if we get only one - // match from any of - // them in toto, then return that, otherwise return an empty CommandObjectSP - // and the list of matches. + // match from any of them in toto, then return that, otherwise return an + // empty CommandObjectSP and the list of matches. if (HasCommands()) { num_cmd_matches = @@ -953,10 +951,9 @@ CommandObjectSP cmd_obj_sp = GetCommandSP(llvm::StringRef(cmd_words.GetArgumentAtIndex(0)), include_aliases, true, nullptr); if (cmd_obj_sp.get() != nullptr) { - // Loop through the rest of the words in the command (everything passed in - // was supposed to be part of a - // command name), and find the appropriate sub-command SP for each command - // word.... + // Loop through the rest of the words in the command (everything passed + // in was supposed to be part of a command name), and find the + // appropriate sub-command SP for each command word.... size_t end = cmd_words.GetArgumentCount(); for (size_t j = 1; j < end; ++j) { if (cmd_obj_sp->IsMultiwordObject()) { @@ -986,8 +983,7 @@ GetCommandSP(cmd_str, false, true, matches).get(); // If we didn't find an exact match to the command string in the commands, - // look in - // the aliases. + // look in the aliases. if (command_obj) return command_obj; @@ -1002,8 +998,7 @@ command_obj = GetCommandSP(cmd_str, false, false, nullptr).get(); // Finally, if there wasn't an inexact match among the commands, look for an - // inexact - // match in both the commands and aliases. + // inexact match in both the commands and aliases. if (command_obj) { if (matches) @@ -1166,8 +1161,8 @@ CommandObject *CommandInterpreter::GetCommandObjectForCommand( llvm::StringRef &command_string) { // This function finds the final, lowest-level, alias-resolved command object - // whose 'Execute' function will - // eventually be invoked by the given command line. + // whose 'Execute' function will eventually be invoked by the given command + // line. CommandObject *cmd_obj = nullptr; size_t start = command_string.find_first_not_of(k_white_space); @@ -1238,8 +1233,8 @@ break; if (pos > 0) { if (isspace(s[pos - 1])) { - // Check if the string ends "\s--" (where \s is a space character) - // or if we have "\s--\s". + // Check if the string ends "\s--" (where \s is a space character) or + // if we have "\s--\s". if ((pos + 2 >= s_len) || isspace(s[pos + 2])) { return pos; } @@ -1374,20 +1369,19 @@ } Status CommandInterpreter::PreprocessCommand(std::string &command) { - // The command preprocessor needs to do things to the command - // line before any parsing of arguments or anything else is done. - // The only current stuff that gets preprocessed is anything enclosed - // in backtick ('`') characters is evaluated as an expression and - // the result of the expression must be a scalar that can be substituted - // into the command. An example would be: + // The command preprocessor needs to do things to the command line before any + // parsing of arguments or anything else is done. The only current stuff that + // gets preprocessed is anything enclosed in backtick ('`') characters is + // evaluated as an expression and the result of the expression must be a + // scalar that can be substituted into the command. An example would be: // (lldb) memory read `$rsp + 20` Status error; // Status for any expressions that might not evaluate size_t start_backtick; size_t pos = 0; while ((start_backtick = command.find('`', pos)) != std::string::npos) { if (start_backtick > 0 && command[start_backtick - 1] == '\\') { - // The backtick was preceded by a '\' character, remove the slash - // and don't treat the backtick as the start of an expression + // The backtick was preceded by a '\' character, remove the slash and + // don't treat the backtick as the start of an expression command.erase(start_backtick - 1, 1); // No need to add one to start_backtick since we just deleted a char pos = start_backtick; @@ -1406,8 +1400,8 @@ ExecutionContext exe_ctx(GetExecutionContext()); Target *target = exe_ctx.GetTargetPtr(); // Get a dummy target to allow for calculator mode while processing - // backticks. - // This also helps break the infinite loop caused when target is null. + // backticks. This also helps break the infinite loop caused when + // target is null. if (!target) target = m_debugger.GetDummyTarget(); if (target) { @@ -1559,8 +1553,8 @@ const char *k_space_characters = "\t\n\v\f\r "; size_t non_space = command_string.find_first_not_of(k_space_characters); - // Check for empty line or comment line (lines whose first - // non-space character is the comment character for this interpreter) + // Check for empty line or comment line (lines whose first non-space + // character is the comment character for this interpreter) if (non_space == std::string::npos) empty_command = true; else if (command_string[non_space] == m_comment_char) @@ -1633,8 +1627,8 @@ CommandObject *cmd_obj = ResolveCommandImpl(command_string, result); // Although the user may have abbreviated the command, the command_string now - // has the command expanded to the full name. For example, if the input - // was "br s -n main", command_string is now "breakpoint set -n main". + // has the command expanded to the full name. For example, if the input was + // "br s -n main", command_string is now "breakpoint set -n main". if (log) { llvm::StringRef command_name = cmd_obj ? cmd_obj->GetCommandName() : ""; log->Printf("HandleCommand, cmd_obj : '%s'", command_name.str().c_str()); @@ -1648,8 +1642,8 @@ // Phase 2. // Take care of things like setting up the history command & calling the - // appropriate Execute method on the - // CommandObject, with the appropriate arguments. + // appropriate Execute method on the CommandObject, with the appropriate + // arguments. if (cmd_obj != nullptr) { if (add_to_history) { @@ -1759,9 +1753,8 @@ if (cursor_index > 0 || look_for_subcommand) { // We are completing further on into a commands arguments, so find the - // command and tell it - // to complete the command. - // First see if there is a matching initial command: + // command and tell it to complete the command. First see if there is a + // matching initial command: CommandObject *command_object = GetCommandObject(parsed_line.GetArgumentAtIndex(0)); if (command_object == nullptr) { @@ -1781,17 +1774,16 @@ int CommandInterpreter::HandleCompletion( const char *current_line, const char *cursor, const char *last_char, int match_start_point, int max_return_elements, StringList &matches) { - // We parse the argument up to the cursor, so the last argument in parsed_line - // is - // the one containing the cursor, and the cursor is after the last character. + // We parse the argument up to the cursor, so the last argument in + // parsed_line is the one containing the cursor, and the cursor is after the + // last character. Args parsed_line(llvm::StringRef(current_line, last_char - current_line)); Args partial_parsed_line( llvm::StringRef(current_line, cursor - current_line)); // Don't complete comments, and if the line we are completing is just the - // history repeat character, - // substitute the appropriate history line. + // history repeat character, substitute the appropriate history line. const char *first_arg = parsed_line.GetArgumentAtIndex(0); if (first_arg) { if (first_arg[0] == m_comment_char) @@ -1818,12 +1810,9 @@ if (cursor > current_line && cursor[-1] == ' ') { // We are just after a space. If we are in an argument, then we will - // continue - // parsing, but if we are between arguments, then we have to complete - // whatever the next - // element would be. - // We can distinguish the two cases because if we are in an argument (e.g. - // because the space is + // continue parsing, but if we are between arguments, then we have to + // complete whatever the next element would be. We can distinguish the two + // cases because if we are in an argument (e.g. because the space is // protected by a quote) then the space will also be in the parsed // argument... @@ -1857,8 +1846,7 @@ matches.InsertStringAtIndex(0, ""); } else { // Now figure out if there is a common substring, and if so put that in - // element 0, otherwise - // put an empty string in element 0. + // element 0, otherwise put an empty string in element 0. std::string command_partial_str; if (cursor_index >= 0) command_partial_str = @@ -1869,9 +1857,8 @@ const size_t partial_name_len = command_partial_str.size(); common_prefix.erase(0, partial_name_len); - // If we matched a unique single command, add a space... - // Only do this if the completer told us this was a complete word, - // however... + // If we matched a unique single command, add a space... Only do this if + // the completer told us this was a complete word, however... if (num_command_matches == 1 && word_complete) { char quote_char = parsed_line[cursor_index].quote; common_prefix = @@ -1949,8 +1936,8 @@ if (option_arg_vector_sp.get()) { if (wants_raw_input) { // We have a command that both has command options and takes raw input. - // Make *sure* it has a - // " -- " in the right place in the raw_input_string. + // Make *sure* it has a " -- " in the right place in the + // raw_input_string. size_t pos = raw_input_string.find(" -- "); if (pos == std::string::npos) { // None found; assume it goes at the beginning of the raw input string @@ -2034,10 +2021,9 @@ } else { result.SetStatus(eReturnStatusSuccessFinishNoResult); // This alias was not created with any options; nothing further needs to be - // done, unless it is a command that - // wants raw input, in which case we need to clear the rest of the data from - // cmd_args, since its in the raw - // input string. + // done, unless it is a command that wants raw input, in which case we need + // to clear the rest of the data from cmd_args, since its in the raw input + // string. if (wants_raw_input) { cmd_args.Clear(); cmd_args.SetArguments(new_args.GetArgumentCount(), @@ -2067,7 +2053,8 @@ while (isdigit(cptr[0])) ++cptr; - // We've gotten to the end of the digits; are we at the end of the string? + // We've gotten to the end of the digits; are we at the end of the + // string? if (cptr[0] == '\0') position = atoi(start); } @@ -2119,12 +2106,12 @@ } } } else { - // If we aren't looking in the current working directory we are looking - // in the home directory. We will first see if there is an application - // specific ".lldbinit" file whose name is "~/.lldbinit" followed by a - // "-" and the name of the program. If this file doesn't exist, we fall - // back to just the "~/.lldbinit" file. We also obey any requests to not - // load the init files. + // If we aren't looking in the current working directory we are looking in + // the home directory. We will first see if there is an application + // specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-" + // and the name of the program. If this file doesn't exist, we fall back to + // just the "~/.lldbinit" file. We also obey any requests to not load the + // init files. llvm::SmallString<64> home_dir_path; llvm::sys::path::home_directory(home_dir_path); FileSpec profilePath(home_dir_path.c_str(), false); @@ -2150,8 +2137,7 @@ } // If the file exists, tell HandleCommand to 'source' it; this will do the - // actual broadcasting - // of the commands back to any appropriate listener (see + // actual broadcasting of the commands back to any appropriate listener (see // CommandObjectSource::Execute for more details). if (init_file.Exists()) { @@ -2197,15 +2183,14 @@ size_t num_lines = commands.GetSize(); // If we are going to continue past a "continue" then we need to run the - // commands synchronously. - // Make sure you reset this value anywhere you return from the function. + // commands synchronously. Make sure you reset this value anywhere you return + // from the function. bool old_async_execution = m_debugger.GetAsyncExecution(); // If we've been given an execution context, set it at the start, but don't - // keep resetting it or we will - // cause series of commands that change the context, then do an operation that - // relies on that context to fail. + // keep resetting it or we will cause series of commands that change the + // context, then do an operation that relies on that context to fail. if (override_context != nullptr) UpdateExecutionContext(override_context); @@ -2230,9 +2215,8 @@ // HandleCommand() since we updated our context already. // We might call into a regex or alias command, in which case the - // add_to_history will get lost. This - // m_command_source_depth dingus is the way we turn off adding to the - // history in that case, so set it up here. + // add_to_history will get lost. This m_command_source_depth dingus is the + // way we turn off adding to the history in that case, so set it up here. if (!options.GetAddToHistory()) m_command_source_depth++; bool success = @@ -2273,18 +2257,17 @@ if (result.GetImmediateErrorStream()) result.GetImmediateErrorStream()->Flush(); - // N.B. Can't depend on DidChangeProcessState, because the state coming into - // the command execution - // could be running (for instance in Breakpoint Commands. - // So we check the return value to see if it is has running in it. + // N.B. Can't depend on DidChangeProcessState, because the state coming + // into the command execution could be running (for instance in Breakpoint + // Commands. So we check the return value to see if it is has running in + // it. if ((tmp_result.GetStatus() == eReturnStatusSuccessContinuingNoResult) || (tmp_result.GetStatus() == eReturnStatusSuccessContinuingResult)) { if (options.GetStopOnContinue()) { // If we caused the target to proceed, and we're going to stop in that - // case, set the - // status in our real result before returning. This is an error if the - // continue was not the - // last command in the set of commands to be run. + // case, set the status in our real result before returning. This is + // an error if the continue was not the last command in the set of + // commands to be run. if (idx != num_lines - 1) result.AppendErrorWithFormat( "Aborting reading of commands after command #%" PRIu64 @@ -2432,8 +2415,8 @@ cmd_file_path.c_str()); } - // Used for inheriting the right settings when "command source" might have - // nested "command source" commands + // Used for inheriting the right settings when "command source" might + // have nested "command source" commands lldb::StreamFileSP empty_stream_sp; m_command_source_flags.push_back(flags); IOHandlerSP io_handler_sp(new IOHandlerEditline( @@ -2746,18 +2729,14 @@ if (is_interactive == false) { // When we are not interactive, don't execute blank lines. This will happen // sourcing a commands file. We don't want blank lines to repeat the - // previous - // command and cause any errors to occur (like redefining an alias, get an - // error - // and stop parsing the commands file). + // previous command and cause any errors to occur (like redefining an + // alias, get an error and stop parsing the commands file). if (line.empty()) return; // When using a non-interactive file handle (like when sourcing commands - // from a file) - // we need to echo the command out so we don't just see the command output - // and no - // command... + // from a file) we need to echo the command out so we don't just see the + // command output and no command... if (io_handler.GetFlags().Test(eHandleCommandFlagEchoCommand)) io_handler.GetOutputStreamFile()->Printf("%s%s\n", io_handler.GetPrompt(), line.c_str()); @@ -2914,13 +2893,13 @@ lldb::IOHandlerSP CommandInterpreter::GetIOHandler(bool force_create, CommandInterpreterRunOptions *options) { - // Always re-create the IOHandlerEditline in case the input - // changed. The old instance might have had a non-interactive - // input and now it does or vice versa. + // Always re-create the IOHandlerEditline in case the input changed. The old + // instance might have had a non-interactive input and now it does or vice + // versa. if (force_create || !m_command_io_handler_sp) { - // Always re-create the IOHandlerEditline in case the input - // changed. The old instance might have had a non-interactive - // input and now it does or vice versa. + // Always re-create the IOHandlerEditline in case the input changed. The + // old instance might have had a non-interactive input and now it does or + // vice versa. uint32_t flags = 0; if (options) { @@ -2954,8 +2933,8 @@ void CommandInterpreter::RunCommandInterpreter( bool auto_handle_events, bool spawn_thread, CommandInterpreterRunOptions &options) { - // Always re-create the command interpreter when we run it in case - // any file handles have changed. + // Always re-create the command interpreter when we run it in case any file + // handles have changed. bool force_create = true; m_debugger.PushIOHandler(GetIOHandler(force_create, &options)); m_stopped_for_crash = false; @@ -3023,8 +3002,8 @@ CommandObject *sub_cmd_obj = cmd_obj->GetSubcommandObject(next_word.c_str()); if (sub_cmd_obj) { - // The subcommand's name includes the parent command's name, - // so restart rather than append to the revised_command_line. + // The subcommand's name includes the parent command's name, so + // restart rather than append to the revised_command_line. llvm::StringRef sub_cmd_name = sub_cmd_obj->GetCommandName(); actual_cmd_name_len = sub_cmd_name.size() + 1; revised_command_line.Clear(); Index: lldb/trunk/source/Interpreter/CommandObject.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandObject.cpp +++ lldb/trunk/source/Interpreter/CommandObject.cpp @@ -90,8 +90,8 @@ void CommandObject::SetSyntax(llvm::StringRef str) { m_cmd_syntax = str; } Options *CommandObject::GetOptions() { - // By default commands don't have options unless this virtual function - // is overridden by base classes. + // By default commands don't have options unless this virtual function is + // overridden by base classes. return nullptr; } @@ -138,10 +138,10 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) { #ifdef LLDB_CONFIGURATION_DEBUG - // Nothing should be stored in m_exe_ctx between running commands as m_exe_ctx - // has shared pointers to the target, process, thread and frame and we don't - // want any CommandObject instances to keep any of these objects around - // longer than for a single command. Every command should call + // Nothing should be stored in m_exe_ctx between running commands as + // m_exe_ctx has shared pointers to the target, process, thread and frame and + // we don't want any CommandObject instances to keep any of these objects + // around longer than for a single command. Every command should call // CommandObject::Cleanup() after it has completed assert(m_exe_ctx.GetTargetPtr() == NULL); assert(m_exe_ctx.GetProcessPtr() == NULL); @@ -149,9 +149,9 @@ assert(m_exe_ctx.GetFramePtr() == NULL); #endif - // Lock down the interpreter's execution context prior to running the - // command so we guarantee the selected target, process, thread and frame - // can't go away during the execution + // Lock down the interpreter's execution context prior to running the command + // so we guarantee the selected target, process, thread and frame can't go + // away during the execution m_exe_ctx = m_interpreter.GetExecutionContext(); const uint32_t flags = GetFlags().Get(); @@ -266,9 +266,8 @@ int max_return_elements, bool &word_complete, StringList &matches) { // Default implementation of WantsCompletion() is !WantsRawCommandString(). - // Subclasses who want raw command string but desire, for example, - // argument completion should override WantsCompletion() to return true, - // instead. + // Subclasses who want raw command string but desire, for example, argument + // completion should override WantsCompletion() to return true, instead. if (WantsRawCommandString() && !WantsCompletion()) { // FIXME: Abstract telling the completion to insert the completion // character. @@ -424,9 +423,10 @@ return ret_val; } -// Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means take -// all the argument data into account. On rare cases where some argument sticks -// with certain option sets, this function returns the option set filtered args. +// Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means +// take all the argument data into account. On rare cases where some argument +// sticks with certain option sets, this function returns the option set +// filtered args. void CommandObject::GetFormattedCommandArguments(Stream &str, uint32_t opt_set_mask) { int num_args = m_arguments.size(); @@ -466,8 +466,7 @@ first_name, second_name); break; // Explicitly test for all the rest of the cases, so if new types get - // added we will notice the - // missing case statement(s). + // added we will notice the missing case statement(s). case eArgRepeatPlain: case eArgRepeatOptional: case eArgRepeatPlus: @@ -503,8 +502,7 @@ str.Printf("<%s_1> .. <%s_n>", name_str.c_str(), name_str.c_str()); break; // Explicitly test for all the rest of the cases, so if new types get - // added we will notice the - // missing case statement(s). + // added we will notice the missing case statement(s). case eArgRepeatPairPlain: case eArgRepeatPairOptional: case eArgRepeatPairPlus: @@ -512,8 +510,8 @@ case eArgRepeatPairRange: case eArgRepeatPairRangeOptional: // These should not be hit, as they should pass the IsPairType test - // above, and control should - // have gone into the other branch of the if statement. + // above, and control should have gone into the other branch of the if + // statement. break; } } @@ -857,9 +855,8 @@ if (!IsDashDashCommand() && options && options->NumCommandOptions() > 0) { if (WantsRawCommandString() && !WantsCompletion()) { // Emit the message about using ' -- ' between the end of the command - // options and the raw input - // conditionally, i.e., only if the command object does not want - // completion. + // options and the raw input conditionally, i.e., only if the command + // object does not want completion. interpreter.OutputFormattedHelpText( output_strm, "", "", "\nImportant Note: Because this command takes 'raw' input, if you " @@ -899,8 +896,8 @@ id_range_arg.arg_repetition = eArgRepeatOptional; // The first (and only) argument for this command could be either an id or an - // id_range. - // Push both variants into the entry for the first argument for this command. + // id_range. Push both variants into the entry for the first argument for + // this command. arg.push_back(id_arg); arg.push_back(id_range_arg); } Index: lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp +++ lldb/trunk/source/Interpreter/CommandObjectRegexCommand.cpp @@ -63,8 +63,8 @@ if (m_interpreter.GetExpandRegexAliases()) result.GetOutputStream().Printf("%s\n", new_command.c_str()); // Pass in true for "no context switching". The command that called us - // should have set up the context - // appropriately, we shouldn't have to redo that. + // should have set up the context appropriately, we shouldn't have to + // redo that. return m_interpreter.HandleCommand(new_command.c_str(), eLazyBoolCalculate, result, nullptr, true, true); Index: lldb/trunk/source/Interpreter/CommandReturnObject.cpp =================================================================== --- lldb/trunk/source/Interpreter/CommandReturnObject.cpp +++ lldb/trunk/source/Interpreter/CommandReturnObject.cpp @@ -25,8 +25,8 @@ if (s.empty()) { add_newline = add_newline_if_empty; } else { - // We already checked for empty above, now make sure there is a newline - // in the error, and if there isn't one, add one. + // We already checked for empty above, now make sure there is a newline in + // the error, and if there isn't one, add one. strm.Write(s.c_str(), s.size()); const char last_char = *s.rbegin(); @@ -127,8 +127,8 @@ SetStatus(eReturnStatusFailed); } -// Similar to AppendError, but do not prepend 'Status: ' to message, and -// don't append "\n" to the end of it. +// Similar to AppendError, but do not prepend 'Status: ' to message, and don't +// append "\n" to the end of it. void CommandReturnObject::AppendRawError(llvm::StringRef in_string) { if (in_string.empty()) Index: lldb/trunk/source/Interpreter/OptionArgParser.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionArgParser.cpp +++ lldb/trunk/source/Interpreter/OptionArgParser.cpp @@ -205,9 +205,9 @@ } } else { - // Since the compiler can't handle things like "main + 12" we should - // try to do this for now. The compiler doesn't like adding offsets - // to function pointer types. + // Since the compiler can't handle things like "main + 12" we should try to + // do this for now. The compiler doesn't like adding offsets to function + // pointer types. static RegularExpression g_symbol_plus_offset_regex( "^(.*)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*$"); RegularExpression::Match regex_match(3); Index: lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp +++ lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp @@ -45,8 +45,8 @@ ExecutionContext *execution_context) { Status error; if (m_option_definition.option_has_arg == OptionParser::eNoArgument) { - // Not argument, toggle the default value and mark the option as having been - // set + // Not argument, toggle the default value and mark the option as having + // been set m_value.SetCurrentValue(!m_value.GetDefaultValue()); m_value.SetOptionWasSet(); } else { Index: lldb/trunk/source/Interpreter/OptionGroupFormat.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionGroupFormat.cpp +++ lldb/trunk/source/Interpreter/OptionGroupFormat.cpp @@ -102,8 +102,8 @@ // We the first character of the "gdb_format_str" is not the // NULL terminator, we didn't consume the entire string and - // something is wrong. Also, if none of the format, size or count - // was specified correctly, then abort. + // something is wrong. Also, if none of the format, size or count was + // specified correctly, then abort. if (!gdb_format_str.empty() || (format == eFormatInvalid && byte_size == 0 && count == 0)) { // Nothing got set correctly @@ -112,9 +112,8 @@ return error; } - // At least one of the format, size or count was set correctly. - // Anything that wasn't set correctly should be set to the - // previous default + // At least one of the format, size or count was set correctly. Anything + // that wasn't set correctly should be set to the previous default if (format == eFormatInvalid) ParserGDBFormatLetter(execution_context, m_prev_gdb_format, format, byte_size); @@ -127,9 +126,8 @@ ParserGDBFormatLetter(execution_context, m_prev_gdb_size, format, byte_size); } else { - // Byte size is disabled, make sure it wasn't specified - // but if this is an address, it's actually necessary to - // specify one so don't error out + // Byte size is disabled, make sure it wasn't specified but if this is an + // address, it's actually necessary to specify one so don't error out if (byte_size > 0 && format != lldb::eFormatAddressInfo) { error.SetErrorString( "this command doesn't support specifying a byte size"); @@ -235,10 +233,9 @@ case 'w': case 'g': { - // Size isn't used for printing instructions, so if a size is specified, and - // the previous format was - // 'i', then we should reset it to the default ('x'). Otherwise we'll - // continue to print as instructions, + // Size isn't used for printing instructions, so if a size is specified, + // and the previous format was 'i', then we should reset it to the + // default ('x'). Otherwise we'll continue to print as instructions, // which isn't expected. if (format_letter == 'b') byte_size = 1; Index: lldb/trunk/source/Interpreter/OptionGroupVariable.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionGroupVariable.cpp +++ lldb/trunk/source/Interpreter/OptionGroupVariable.cpp @@ -132,12 +132,12 @@ llvm::ArrayRef OptionGroupVariable::GetDefinitions() { auto result = llvm::makeArrayRef(g_variable_options); - // Show the "--no-args", "--no-locals" and "--show-globals" - // options if we are showing frame specific options + // Show the "--no-args", "--no-locals" and "--show-globals" options if we are + // showing frame specific options if (include_frame_options) return result; - // Skip the "--no-args", "--no-locals" and "--show-globals" - // options if we are not showing frame specific options (globals only) + // Skip the "--no-args", "--no-locals" and "--show-globals" options if we are + // not showing frame specific options (globals only) return result.drop_front(NUM_FRAME_OPTS); } Index: lldb/trunk/source/Interpreter/OptionValue.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValue.cpp +++ lldb/trunk/source/Interpreter/OptionValue.cpp @@ -20,9 +20,8 @@ using namespace lldb_private; //------------------------------------------------------------------------- -// Get this value as a uint64_t value if it is encoded as a boolean, -// uint64_t or int64_t. Other types will cause "fail_value" to be -// returned +// Get this value as a uint64_t value if it is encoded as a boolean, uint64_t +// or int64_t. Other types will cause "fail_value" to be returned //------------------------------------------------------------------------- uint64_t OptionValue::GetUInt64Value(uint64_t fail_value, bool *success_ptr) { if (success_ptr) @@ -508,8 +507,8 @@ lldb::OptionValueSP OptionValue::CreateValueFromCStringForTypeMask( const char *value_cstr, uint32_t type_mask, Status &error) { - // If only 1 bit is set in the type mask for a dictionary or array - // then we know how to decode a value from a cstring + // If only 1 bit is set in the type mask for a dictionary or array then we + // know how to decode a value from a cstring lldb::OptionValueSP value_sp; switch (type_mask) { case 1u << eTypeArch: Index: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp +++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp @@ -128,9 +128,7 @@ if (key.front() == '[') { // Key name starts with '[', so the key value must be in single or - // double quotes like: - // [''] - // [""] + // double quotes like: [''] [""] if ((key.size() > 2) && (key.back() == ']')) { // Strip leading '[' and trailing ']' key = key.substr(1, key.size() - 2); @@ -286,8 +284,8 @@ bool OptionValueDictionary::SetValueForKey(const ConstString &key, const lldb::OptionValueSP &value_sp, bool can_replace) { - // Make sure the value_sp object is allowed to contain - // values of the type passed in... + // Make sure the value_sp object is allowed to contain values of the type + // passed in... if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) { if (!can_replace) { collection::const_iterator pos = m_values.find(key); Index: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp +++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp @@ -67,13 +67,10 @@ case eVarSetOperationAssign: if (value.size() > 0) { // The setting value may have whitespace, double-quotes, or single-quotes - // around the file - // path to indicate that internal spaces are not word breaks. Strip off - // any ws & quotes - // from the start and end of the file path - we aren't doing any word // - // breaking here so - // the quoting is unnecessary. NB this will cause a problem if someone - // tries to specify + // around the file path to indicate that internal spaces are not word + // breaks. Strip off any ws & quotes from the start and end of the file + // path - we aren't doing any word // breaking here so the quoting is + // unnecessary. NB this will cause a problem if someone tries to specify // a file path that legitimately begins or ends with a " or ' character, // or whitespace. value = value.trim("\"' \t"); Index: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp +++ lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp @@ -64,12 +64,10 @@ case eVarSetOperationReplace: case eVarSetOperationAssign: { // Check if the string starts with a quote character after removing leading - // and trailing spaces. - // If it does start with a quote character, make sure it ends with the same - // quote character - // and remove the quotes before we parse the format string. If the string - // doesn't start with - // a quote, leave the string alone and parse as is. + // and trailing spaces. If it does start with a quote character, make sure + // it ends with the same quote character and remove the quotes before we + // parse the format string. If the string doesn't start with a quote, leave + // the string alone and parse as is. llvm::StringRef trimmed_value_str = value_str.trim(); if (!trimmed_value_str.empty()) { const char first_char = trimmed_value_str[0]; Index: lldb/trunk/source/Interpreter/OptionValueProperties.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueProperties.cpp +++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp @@ -35,15 +35,13 @@ m_name(global_properties.m_name), m_properties(global_properties.m_properties), m_name_to_index(global_properties.m_name_to_index) { - // We now have an exact copy of "global_properties". We need to now - // find all non-global settings and copy the property values so that - // all non-global settings get new OptionValue instances created for - // them. + // We now have an exact copy of "global_properties". We need to now find all + // non-global settings and copy the property values so that all non-global + // settings get new OptionValue instances created for them. const size_t num_properties = m_properties.size(); for (size_t i = 0; i < num_properties; ++i) { // Duplicate any values that are not global when constructing properties - // from - // a global copy + // from a global copy if (m_properties[i].IsGlobal() == false) { lldb::OptionValueSP new_value_sp(m_properties[i].GetValue()->DeepCopy()); m_properties[i].SetOptionValue(new_value_sp); @@ -157,15 +155,13 @@ case '{': // Predicate matching for predicates like // "{}" - // strings are parsed by the current OptionValueProperties subclass - // to mean whatever they want to. For instance a subclass of - // OptionValueProperties for a lldb_private::Target might implement: - // "target.run-args{arch==i386}" -- only set run args if the arch is - // i386 - // "target.run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the - // path matches - // "target.run-args{basename==test&&arch==x86_64}" -- only set run args - // if executable basename is "test" and arch is "x86_64" + // strings are parsed by the current OptionValueProperties subclass to mean + // whatever they want to. For instance a subclass of OptionValueProperties + // for a lldb_private::Target might implement: "target.run- + // args{arch==i386}" -- only set run args if the arch is i386 "target + // .run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the path + // matches "target.run-args{basename==test&&arch==x86_64}" -- only set run + // args if executable basename is "test" and arch is "x86_64" if (sub_name[1]) { llvm::StringRef predicate_start = sub_name.drop_front(); size_t pos = predicate_start.find_first_of('}'); @@ -189,9 +185,8 @@ break; case '[': - // Array or dictionary access for subvalues like: - // "[12]" -- access 12th array element - // "['hello']" -- dictionary access of key named hello + // Array or dictionary access for subvalues like: "[12]" -- access + // 12th array element "['hello']" -- dictionary access of key named hello return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error); default: Index: lldb/trunk/source/Interpreter/OptionValueSInt64.cpp =================================================================== --- lldb/trunk/source/Interpreter/OptionValueSInt64.cpp +++ lldb/trunk/source/Interpreter/OptionValueSInt64.cpp @@ -21,7 +21,8 @@ void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) { - // printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %" PRIi64 + // printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %" + // PRIi64 // "\n", this, exe_ctx, m_current_value); if (dump_mask & eDumpOptionType) strm.Printf("(%s)", GetTypeAsCString()); Index: lldb/trunk/source/Interpreter/Options.cpp =================================================================== --- lldb/trunk/source/Interpreter/Options.cpp +++ lldb/trunk/source/Interpreter/Options.cpp @@ -115,13 +115,12 @@ int num_levels = GetRequiredOptions().size(); if (num_levels) { for (int i = 0; i < num_levels && !options_are_valid; ++i) { - // This is the correct set of options if: 1). m_seen_options contains all - // of m_required_options[i] - // (i.e. all the required options at this level are a subset of - // m_seen_options); AND - // 2). { m_seen_options - m_required_options[i] is a subset of - // m_options_options[i] (i.e. all the rest of - // m_seen_options are in the set of optional options at this level. + // This is the correct set of options if: 1). m_seen_options contains + // all of m_required_options[i] (i.e. all the required options at this + // level are a subset of m_seen_options); AND 2). { m_seen_options - + // m_required_options[i] is a subset of m_options_options[i] (i.e. all + // the rest of m_seen_options are in the set of optional options at this + // level. // Check to see if all of m_required_options[i] are a subset of // m_seen_options @@ -152,8 +151,7 @@ } // This is called in the Options constructor, though we could call it lazily if -// that ends up being -// a performance problem. +// that ends up being a performance problem. void Options::BuildValidOptionSets() { // Check to see if we already did this. @@ -265,13 +263,11 @@ } // This function takes INDENT, which tells how many spaces to output at the -// front of each line; SPACES, which is -// a string containing 80 spaces; and TEXT, which is the text that is to be -// output. It outputs the text, on +// front of each line; SPACES, which is a string containing 80 spaces; and +// TEXT, which is the text that is to be output. It outputs the text, on // multiple lines if necessary, to RESULT, with INDENT spaces at the front of -// each line. It breaks lines on spaces, -// tabs or newlines, shortening the line if necessary to not break in the middle -// of a word. It assumes that each +// each line. It breaks lines on spaces, tabs or newlines, shortening the line +// if necessary to not break in the middle of a word. It assumes that each // output line should contain a maximum of OUTPUT_MAX_COLUMNS characters. void Options::OutputFormattedUsageText(Stream &strm, @@ -421,8 +417,8 @@ strm.IndentMore(2); - // First, show each usage level set of options, e.g. - // [options-for-level-0] + // First, show each usage level set of options, e.g. [options-for- + // level-0] // // [options-for-level-1] // etc. @@ -449,9 +445,9 @@ if (cmd) cmd->GetFormattedCommandArguments(args_str, opt_set_mask); - // First go through and print all options that take no arguments as - // a single string. If a command has "-a" "-b" and "-c", this will show - // up as [-abc] + // First go through and print all options that take no arguments as a + // single string. If a command has "-a" "-b" and "-c", this will show up + // as [-abc] std::set options; std::set::const_iterator options_pos, options_end; @@ -554,24 +550,23 @@ // help text // This variable is used to keep track of which options' info we've printed - // out, because some options can be in - // more than one usage level, but we only want to print the long form of its - // information once. + // out, because some options can be in more than one usage level, but we + // only want to print the long form of its information once. std::multimap options_seen; strm.IndentMore(5); // Put the unique command options in a vector & sort it, so we can output - // them alphabetically (by short_option) - // when writing out detailed help for each option. + // them alphabetically (by short_option) when writing out detailed help for + // each option. i = 0; for (auto &def : opt_defs) options_seen.insert(std::make_pair(def.short_option, i++)); - // Go through the unique'd and alphabetically sorted vector of options, find - // the table entry for each option - // and write out the detailed help information for that option. + // Go through the unique'd and alphabetically sorted vector of options, + // find the table entry for each option and write out the detailed help + // information for that option. bool first_option_printed = false; @@ -627,14 +622,10 @@ } // This function is called when we have been given a potentially incomplete set -// of -// options, such as when an alias has been defined (more options might be added -// at -// at the time the alias is invoked). We need to verify that the options in the -// set -// m_seen_options are all part of a set that may be used together, but -// m_seen_options -// may be missing some of the "required" options. +// of options, such as when an alias has been defined (more options might be +// added at at the time the alias is invoked). We need to verify that the +// options in the set m_seen_options are all part of a set that may be used +// together, but m_seen_options may be missing some of the "required" options. bool Options::VerifyPartialOptions(CommandReturnObject &result) { bool options_are_valid = false; @@ -643,10 +634,8 @@ if (num_levels) { for (int i = 0; i < num_levels && !options_are_valid; ++i) { // In this case we are treating all options as optional rather than - // required. - // Therefore a set of options is correct if m_seen_options is a subset of - // the - // union of m_required_options and m_optional_options. + // required. Therefore a set of options is correct if m_seen_options is a + // subset of the union of m_required_options and m_optional_options. OptionSet union_set; OptionsSetUnion(GetRequiredOptions()[i], GetOptionalOptions()[i], union_set); @@ -667,7 +656,8 @@ // For now we just scan the completions to see if the cursor position is in // an option or its argument. Otherwise we'll call HandleArgumentCompletion. - // In the future we can use completion to validate options as well if we want. + // In the future we can use completion to validate options as well if we + // want. auto opt_defs = GetDefinitions(); @@ -709,12 +699,10 @@ } return true; } else if (opt_defs_index != OptionArgElement::eUnrecognizedArg) { - // We recognized it, if it an incomplete long option, complete it anyway - // (getopt_long_only is - // happy with shortest unique string, but it's still a nice thing to - // do.) Otherwise return - // The string so the upper level code will know this is a full match and - // add the " ". + // We recognized it, if it an incomplete long option, complete it + // anyway (getopt_long_only is happy with shortest unique string, but + // it's still a nice thing to do.) Otherwise return The string so the + // upper level code will know this is a full match and add the " ". if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' && cur_opt_str[1] == '-' && strcmp(opt_defs[opt_defs_index].long_option, cur_opt_str) != 0) { @@ -731,9 +719,8 @@ // Check to see if they are writing a long option & complete it. // I think we will only get in here if the long option table has two // elements - // that are not unique up to this point. getopt_long_only does shortest - // unique match - // for long options already. + // that are not unique up to this point. getopt_long_only does + // shortest unique match for long options already. if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' && cur_opt_str[1] == '-') { @@ -762,8 +749,8 @@ } } else if (opt_arg_pos == cursor_index) { - // Okay the cursor is on the completion of an argument. - // See if it has a completion, otherwise return no matches. + // Okay the cursor is on the completion of an argument. See if it has a + // completion, otherwise return no matches. if (opt_defs_index != -1) { HandleOptionArgumentCompletion( @@ -813,10 +800,9 @@ return return_value; } - // If this is a source file or symbol type completion, and there is a - // -shlib option somewhere in the supplied arguments, then make a search - // filter - // for that shared library. + // If this is a source file or symbol type completion, and there is a -shlib + // option somewhere in the supplied arguments, then make a search filter for + // that shared library. // FIXME: Do we want to also have an "OptionType" so we don't have to match // string names? @@ -908,8 +894,8 @@ Status OptionGroupOptions::SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) { - // After calling OptionGroupOptions::Append(...), you must finalize the groups - // by calling OptionGroupOptions::Finlize() + // After calling OptionGroupOptions::Append(...), you must finalize the + // groups by calling OptionGroupOptions::Finlize() assert(m_did_finalize); Status error; if (option_idx < m_option_infos.size()) { @@ -1111,8 +1097,8 @@ option_arg_vector->emplace_back(option_str.GetString(), has_arg, option_arg); - // Find option in the argument list; also see if it was supposed to take - // an argument and if one was supplied. Remove option (and argument, if + // Find option in the argument list; also see if it was supposed to take an + // argument and if one was supplied. Remove option (and argument, if // given) from the argument list. Also remove them from the // raw_input_string, if one was passed in. size_t idx = @@ -1155,8 +1141,8 @@ if (long_options == nullptr) return option_element_vector; - // Leading : tells getopt to return a : for a missing option argument AND - // to suppress error messages. + // Leading : tells getopt to return a : for a missing option argument AND to + // suppress error messages. sstr << ":"; for (int i = 0; long_options[i].definition != nullptr; ++i) { @@ -1339,12 +1325,11 @@ } // Finally we have to handle the case where the cursor index points at a - // single "-". We want to mark that in - // the option_element_vector, but only if it is not after the "--". But it - // turns out that OptionParser::Parse just ignores - // an isolated "-". So we have to look it up by hand here. We only care if - // it is AT the cursor position. - // Note, a single quoted dash is not the same as a single dash... + // single "-". We want to mark that in the option_element_vector, but only + // if it is not after the "--". But it turns out that OptionParser::Parse + // just ignores an isolated "-". So we have to look it up by hand here. We + // only care if it is AT the cursor position. Note, a single quoted dash is + // not the same as a single dash... const Args::ArgEntry &cursor = args[cursor_index]; if ((static_cast(dash_dash_pos) == -1 || @@ -1426,8 +1411,8 @@ const OptionDefinition *def = long_options[long_options_index].definition; if (!platform_sp) { - // User did not pass in an explicit platform. Try to grab - // from the execution context. + // User did not pass in an explicit platform. Try to grab from the + // execution context. TargetSP target_sp = execution_context ? execution_context->GetTargetSP() : TargetSP(); platform_sp = target_sp ? target_sp->GetPlatform() : PlatformSP(); @@ -1435,9 +1420,8 @@ OptionValidator *validator = def->validator; if (!platform_sp && require_validation) { - // Caller requires validation but we cannot validate as we - // don't have the mandatory platform against which to - // validate. + // Caller requires validation but we cannot validate as we don't have + // the mandatory platform against which to validate. return llvm::make_error( "cannot validate options: no platform available", llvm::inconvertibleErrorCode()); Index: lldb/trunk/source/Interpreter/Property.cpp =================================================================== --- lldb/trunk/source/Interpreter/Property.cpp +++ lldb/trunk/source/Interpreter/Property.cpp @@ -77,8 +77,7 @@ // "definition.default_uint_value" is the default enumeration value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the - // default - // value. + // default value. { OptionValueEnumeration *enum_value = new OptionValueEnumeration( definition.enum_values, definition.default_uint_value); @@ -89,10 +88,10 @@ llvm::StringRef(definition.default_cstr_value)) .Success()) { enum_value->SetDefaultValue(enum_value->GetCurrentValue()); - // Call Clear() since we don't want the value to appear as - // having been set since we called SetValueFromString() above. - // Clear will set the current value to the default and clear - // the boolean that says that the value has been set. + // Call Clear() since we don't want the value to appear as having + // been set since we called SetValueFromString() above. Clear will + // set the current value to the default and clear the boolean that + // says that the value has been set. enum_value->Clear(); } } @@ -101,8 +100,7 @@ case OptionValue::eTypeFileSpec: { // "definition.default_uint_value" represents if the - // "definition.default_cstr_value" should - // be resolved or not + // "definition.default_cstr_value" should be resolved or not const bool resolve = definition.default_uint_value != 0; m_value_sp.reset(new OptionValueFileSpec( FileSpec(definition.default_cstr_value, resolve), resolve)); @@ -117,11 +115,9 @@ case OptionValue::eTypeFormat: // "definition.default_uint_value" is the default format enumeration value - // if - // "definition.default_cstr_value" is NULL, otherwise interpret + // if "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the - // default - // value. + // default value. { Format new_format = eFormatInvalid; if (definition.default_cstr_value) @@ -134,12 +130,10 @@ break; case OptionValue::eTypeLanguage: - // "definition.default_uint_value" is the default language enumeration value - // if - // "definition.default_cstr_value" is NULL, otherwise interpret + // "definition.default_uint_value" is the default language enumeration + // value if "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the - // default - // value. + // default value. { LanguageType new_lang = eLanguageTypeUnknown; if (definition.default_cstr_value) @@ -160,8 +154,7 @@ case OptionValue::eTypePathMap: // "definition.default_uint_value" tells us if notifications should occur - // for - // path mappings + // for path mappings m_value_sp.reset( new OptionValuePathMappings(definition.default_uint_value != 0)); break; @@ -177,8 +170,7 @@ // "definition.default_uint_value" is the default integer value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the - // default - // value. + // default value. m_value_sp.reset(new OptionValueSInt64( definition.default_cstr_value ? StringConvert::ToSInt64(definition.default_cstr_value) @@ -189,8 +181,7 @@ // "definition.default_uint_value" is the default unsigned integer value if // "definition.default_cstr_value" is NULL, otherwise interpret // "definition.default_cstr_value" as a string value that represents the - // default - // value. + // default value. m_value_sp.reset(new OptionValueUInt64( definition.default_cstr_value ? StringConvert::ToUInt64(definition.default_cstr_value) @@ -209,9 +200,9 @@ break; case OptionValue::eTypeString: - // "definition.default_uint_value" can contain the string option flags OR'ed - // together - // "definition.default_cstr_value" can contain a default string value + // "definition.default_uint_value" can contain the string option flags + // OR'ed together "definition.default_cstr_value" can contain a default + // string value { OptionValueString *string_value = new OptionValueString(definition.default_cstr_value); Index: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -1466,8 +1466,8 @@ addr_t sp = 0; for (uint32_t value_idx = 0; value_idx < num_values; ++value_idx) { - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? Value *value = values.GetValueAtIndex(value_idx); if (!value) @@ -1589,10 +1589,8 @@ case 128: if (IsArmv7kProcess()) { // "A composite type not larger than 16 bytes is returned in r0-r3. The - // format is - // as if the result had been stored in memory at a word-aligned address - // and then - // loaded into r0-r3 with an ldm instruction" + // format is as if the result had been stored in memory at a word- + // aligned address and then loaded into r0-r3 with an ldm instruction" { const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfoByName("r1", 0); @@ -1756,10 +1754,8 @@ } } else if (num_bytes <= 16 && IsArmv7kProcess()) { // "A composite type not larger than 16 bytes is returned in r0-r3. The - // format is - // as if the result had been stored in memory at a word-aligned address - // and then - // loaded into r0-r3 with an ldm instruction" + // format is as if the result had been stored in memory at a word-aligned + // address and then loaded into r0-r3 with an ldm instruction" const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("r0", 0); const RegisterInfo *r1_info = reg_ctx->GetRegisterInfoByName("r1", 0); Index: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp @@ -1760,8 +1760,8 @@ addr_t sp = 0; for (uint32_t value_idx = 0; value_idx < num_values; ++value_idx) { - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? Value *value = values.GetValueAtIndex(value_idx); if (!value) @@ -2022,10 +2022,9 @@ } // AAPCS64 (Procedure Call Standard for the ARM 64-bit Architecture) says -// registers x19 through x28 and sp are callee preserved. -// v8-v15 are non-volatile (and specifically only the lower 8 bytes of these -// regs), -// the rest of the fp/SIMD registers are volatile. +// registers x19 through x28 and sp are callee preserved. v8-v15 are non- +// volatile (and specifically only the lower 8 bytes of these regs), the rest +// of the fp/SIMD registers are volatile. // We treat x29 as callee preserved also, else the unwinder won't try to // retrieve fp saves. @@ -2209,14 +2208,14 @@ } else { const RegisterInfo *reg_info = nullptr; if (is_return_value) { - // We are assuming we are decoding this immediately after returning - // from a function call and that the address of the structure is in x8 + // We are assuming we are decoding this immediately after returning from + // a function call and that the address of the structure is in x8 reg_info = reg_ctx->GetRegisterInfoByName("x8", 0); } else { // We are assuming we are stopped at the first instruction in a function - // and that the ABI is being respected so all parameters appear where they - // should be (functions with no external linkage can legally violate the - // ABI). + // and that the ABI is being respected so all parameters appear where + // they should be (functions with no external linkage can legally violate + // the ABI). if (NGRN >= 8) return false; Index: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp @@ -736,10 +736,10 @@ uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); - // When writing a register value down to memory, the register info used - // to write memory just needs to have the correct size of a 32 bit register, - // the actual register it pertains to is not important, just the size needs - // to be correct. Here we use "eax"... + // When writing a register value down to memory, the register info used to + // write memory just needs to have the correct size of a 32 bit register, the + // actual register it pertains to is not important, just the size needs to be + // correct. Here we use "eax"... const RegisterInfo *reg_info_32 = reg_ctx->GetRegisterInfoByName("eax"); if (!reg_info_32) return false; // TODO this should actually never happen @@ -828,8 +828,8 @@ if (!value) return false; - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? CompilerType compiler_type(value->GetCompilerType()); if (compiler_type) { bool is_signed; @@ -1075,12 +1075,13 @@ } // v. -// http://developer.apple.com/library/mac/#documentation/developertools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW4 +// http://developer.apple.com/library/mac/#documentation/developertools/Conceptual/LowLevelABI/130 +// -IA- +// 32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW4 // // This document ("OS X ABI Function Call Guide", chapter "IA-32 Function -// Calling Conventions") -// says that the following registers on i386 are preserved aka non-volatile aka -// callee-saved: +// Calling Conventions") says that the following registers on i386 are +// preserved aka non-volatile aka callee-saved: // // ebx, ebp, esi, edi, esp Index: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -1470,8 +1470,8 @@ addr_t sp = 0; for (uint32_t value_idx = 0; value_idx < num_values; ++value_idx) { - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? Value *value = values.GetValueAtIndex(value_idx); if (!value) Index: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp @@ -1763,8 +1763,8 @@ addr_t sp = 0; for (uint32_t value_idx = 0; value_idx < num_values; ++value_idx) { - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? Value *value = values.GetValueAtIndex(value_idx); if (!value) @@ -1994,10 +1994,9 @@ } // AAPCS64 (Procedure Call Standard for the ARM 64-bit Architecture) says -// registers x19 through x28 and sp are callee preserved. -// v8-v15 are non-volatile (and specifically only the lower 8 bytes of these -// regs), -// the rest of the fp/SIMD registers are volatile. +// registers x19 through x28 and sp are callee preserved. v8-v15 are non- +// volatile (and specifically only the lower 8 bytes of these regs), the rest +// of the fp/SIMD registers are volatile. // We treat x29 as callee preserved also, else the unwinder won't try to // retrieve fp saves. @@ -2020,10 +2019,10 @@ if (name[0] == 'x' || name[0] == 'r') { // Volatile registers: x0-x18 - // Although documentation says only x19-28 + sp are callee saved - // We ll also have to treat x30 as non-volatile. - // Each dwarf frame has its own value of lr. - // Return false for the non-volatile gpr regs, true for everything else + // Although documentation says only x19-28 + sp are callee saved We ll + // also have to treat x30 as non-volatile. Each dwarf frame has its own + // value of lr. Return false for the non-volatile gpr regs, true for + // everything else switch (name[1]) { case '1': switch (name[2]) { @@ -2180,14 +2179,14 @@ } else { const RegisterInfo *reg_info = nullptr; if (is_return_value) { - // We are assuming we are decoding this immediately after returning - // from a function call and that the address of the structure is in x8 + // We are assuming we are decoding this immediately after returning from + // a function call and that the address of the structure is in x8 reg_info = reg_ctx->GetRegisterInfoByName("x8", 0); } else { // We are assuming we are stopped at the first instruction in a function - // and that the ABI is being respected so all parameters appear where they - // should be (functions with no external linkage can legally violate the - // ABI). + // and that the ABI is being respected so all parameters appear where + // they should be (functions with no external linkage can legally violate + // the ABI). if (NGRN >= 8) return false; Index: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp @@ -1214,8 +1214,8 @@ return return_valobj_sp; } -// called when we are on the first instruction of a new function -// for hexagon the return address is in RA (R31) +// called when we are on the first instruction of a new function for hexagon +// the return address is in RA (R31) bool ABISysV_hexagon::CreateFunctionEntryUnwindPlan(UnwindPlan &unwind_plan) { unwind_plan.Clear(); unwind_plan.SetRegisterKind(eRegisterKindGeneric); Index: lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp @@ -3,8 +3,7 @@ // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source -// License. -// See LICENSE.TXT for details. +// License. See LICENSE.TXT for details. //===----------------------------------------------------------------------===// #include "ABISysV_i386.h" @@ -56,8 +55,8 @@ // DWARF Register Number Mapping // See Table 2.14 of the reference document (specified on top of this file) -// Comment: Table 2.14 is followed till 'mm' entries. -// After that, all entries are ignored here. +// Comment: Table 2.14 is followed till 'mm' entries. After that, all entries +// are ignored here. enum dwarf_regnums { dwarf_eax = 0, @@ -228,12 +227,10 @@ uint32_t sp_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); - // While using register info to write a register value to memory, the register - // info - // just needs to have the correct size of a 32 bit register, the actual - // register it - // pertains to is not important, just the size needs to be correct. - // "eax" is used here for this purpose. + // While using register info to write a register value to memory, the + // register info just needs to have the correct size of a 32 bit register, + // the actual register it pertains to is not important, just the size needs + // to be correct. "eax" is used here for this purpose. const RegisterInfo *reg_info_32 = reg_ctx->GetRegisterInfoByName("eax"); if (!reg_info_32) return false; // TODO this should actually never happen @@ -364,8 +361,8 @@ } // Following "IF ELSE" block categorizes various 'Fundamental Data Types'. - // The terminology 'Fundamental Data Types' used here is adopted from - // Table 2.1 of the reference document (specified on top of this file) + // The terminology 'Fundamental Data Types' used here is adopted from Table + // 2.1 of the reference document (specified on top of this file) if (type_flags & eTypeIsPointer) // 'Pointer' { @@ -390,8 +387,8 @@ default: break; case 16: - // For clang::BuiltinType::UInt128 & Int128 - // ToDo: Need to decide how to handle it + // For clang::BuiltinType::UInt128 & Int128 ToDo: Need to decide how to + // handle it break; case 8: { uint32_t raw_value_low = data.GetMaxU32(&offset, 4); @@ -470,8 +467,8 @@ error.SetErrorString("Implementation is missing for this clang type."); } } else { - // Neither 'Integral' nor 'Floating Point'. If flow reaches here - // then check type_flags. This type_flags is not a valid type. + // Neither 'Integral' nor 'Floating Point'. If flow reaches here then + // check type_flags. This type_flags is not a valid type. error.SetErrorString("Invalid clang type"); } } else { @@ -508,8 +505,8 @@ reg_ctx->GetRegisterInfoByName("edx", 0)->kinds[eRegisterKindLLDB]; // Following "IF ELSE" block categorizes various 'Fundamental Data Types'. - // The terminology 'Fundamental Data Types' used here is adopted from - // Table 2.1 of the reference document (specified on top of this file) + // The terminology 'Fundamental Data Types' used here is adopted from Table + // 2.1 of the reference document (specified on top of this file) if (type_flags & eTypeIsPointer) // 'Pointer' { @@ -543,8 +540,8 @@ break; case 16: - // For clang::BuiltinType::UInt128 & Int128 - // ToDo: Need to decide how to handle it + // For clang::BuiltinType::UInt128 & Int128 ToDo: Need to decide how to + // handle it break; case 8: @@ -612,8 +609,8 @@ success = true; } else if (byte_size == 8) // double is 8 bytes { - // On Android Platform: long double is also 8 bytes - // It will be handled here only. + // On Android Platform: long double is also 8 bytes It will be + // handled here only. double value_double = (double)value_long_double; value.GetScalar() = value_double; success = true; @@ -639,8 +636,8 @@ } } else // Neither 'Integral' nor 'Floating Point' { - // If flow reaches here then check type_flags - // This type_flags is unhandled + // If flow reaches here then check type_flags This type_flags is + // unhandled } } else if (type_flags & eTypeIsComplex) // 'Complex Floating Point' { @@ -797,9 +794,9 @@ return true; } -// According to "Register Usage" in reference document (specified on top -// of this source file) ebx, ebp, esi, edi and esp registers are preserved -// i.e. non-volatile i.e. callee-saved on i386 +// According to "Register Usage" in reference document (specified on top of +// this source file) ebx, ebp, esi, edi and esp registers are preserved i.e. +// non-volatile i.e. callee-saved on i386 bool ABISysV_i386::RegisterIsCalleeSaved(const RegisterInfo *reg_info) { if (!reg_info) return false; Index: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp @@ -698,8 +698,8 @@ if (log) log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr); - // All callers of position independent functions must place the address of the - // called function in t9 (r25) + // All callers of position independent functions must place the address of + // the called function in t9 (r25) if (!reg_ctx->WriteRegisterFromUnsigned(r25_info, func_addr)) return false; @@ -867,8 +867,8 @@ UINT32_MAX; value.GetScalar() = ptr; } else if (return_compiler_type.IsAggregateType()) { - // Structure/Vector is always passed in memory and pointer to that memory is - // passed in r2. + // Structure/Vector is always passed in memory and pointer to that memory + // is passed in r2. uint64_t mem_address = reg_ctx->ReadRegisterAsUnsigned( reg_ctx->GetRegisterInfoByName("r2", 0), 0); // We have got the address. Create a memory object out of it Index: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp @@ -661,8 +661,8 @@ if (log) log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr); - // All callers of position independent functions must place the address of the - // called function in t9 (r25) + // All callers of position independent functions must place the address of + // the called function in t9 (r25) if (!reg_ctx->WriteRegisterFromUnsigned(r25_info, func_addr)) return false; @@ -1035,10 +1035,9 @@ } } - // If we reach here, it means this structure either contains more than two - // fields or - // it contains at least one non floating point type. - // In that case, all fields are returned in GP return registers. + // If we reach here, it means this structure either contains more than + // two fields or it contains at least one non floating point type. In + // that case, all fields are returned in GP return registers. for (uint32_t idx = 0; idx < num_children; idx++) { uint64_t field_bit_offset = 0; bool is_signed; @@ -1049,8 +1048,8 @@ const size_t field_byte_width = field_compiler_type.GetByteSize(nullptr); - // if we don't know the size of the field (e.g. invalid type), just bail - // out + // if we don't know the size of the field (e.g. invalid type), just + // bail out if (field_byte_width == 0) break; @@ -1078,16 +1077,15 @@ } } // We already have consumed at-least 8 bytes that means r2 is done, - // and this field will be in r3. - // Check if this field can fit in r3. + // and this field will be in r3. Check if this field can fit in r3. else if (integer_bytes + field_byte_width + padding <= 16) { integer_bytes = integer_bytes + field_byte_width + padding; use_r3 = 1; } else { - // There isn't any space left for this field, this should not happen - // as we have already checked - // the overall size is not greater than 16 bytes. For now, return a - // nullptr return value object. + // There isn't any space left for this field, this should not + // happen as we have already checked the overall size is not + // greater than 16 bytes. For now, return a nullptr return value + // object. return return_valobj_sp; } } @@ -1123,15 +1121,16 @@ sucess = 1; } if (sucess) { - // The result is in our data buffer. Create a variable object out of it + // The result is in our data buffer. Create a variable object out of + // it return_valobj_sp = ValueObjectConstResult::Create( &thread, return_compiler_type, ConstString(""), return_ext); } return return_valobj_sp; } - // Any structure/vector greater than 16 bytes in size is returned in memory. - // The pointer to that memory is returned in r2. + // Any structure/vector greater than 16 bytes in size is returned in + // memory. The pointer to that memory is returned in r2. uint64_t mem_address = reg_ctx->ReadRegisterAsUnsigned( reg_ctx->GetRegisterInfoByName("r2", 0), 0); Index: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp @@ -402,8 +402,8 @@ if (!value) return false; - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? CompilerType compiler_type = value->GetCompilerType(); if (!compiler_type) return false; @@ -501,8 +501,8 @@ if (!set_it_simple) { // Okay we've got a structure or something that doesn't fit in a simple - // register. - // We should figure out where it really goes, but we don't support this yet. + // register. We should figure out where it really goes, but we don't + // support this yet. error.SetErrorString("We only support setting simple integer and float " "return types at present."); } @@ -735,10 +735,9 @@ copy_from_offset = integer_bytes - 8; integer_bytes += field_byte_width; } else { - // The last field didn't fit. I can't see how that would happen w/o - // the overall size being - // greater than 16 bytes. For now, return a nullptr return value - // object. + // The last field didn't fit. I can't see how that would happen + // w/o the overall size being greater than 16 bytes. For now, + // return a nullptr return value object. return return_valobj_sp; } } else if (field_compiler_type.IsFloatingPointType(count, is_complex)) { @@ -751,10 +750,9 @@ fp_bytes += field_byte_width; } else if (field_bit_width == 32) { // This one is kind of complicated. If we are in an "eightbyte" - // with another float, we'll - // be stuffed into an xmm register with it. If we are in an - // "eightbyte" with one or more ints, - // then we will be stuffed into the appropriate GPR with them. + // with another float, we'll be stuffed into an xmm register with + // it. If we are in an "eightbyte" with one or more ints, then we + // will be stuffed into the appropriate GPR with them. bool in_gpr; if (field_byte_offset % 8 == 0) { // We are at the beginning of one of the eightbytes, so check the @@ -776,9 +774,9 @@ } } } else if (field_byte_offset % 4 == 0) { - // We are inside of an eightbyte, so see if the field before us is - // floating point: - // This could happen if somebody put padding in the structure. + // We are inside of an eightbyte, so see if the field before us + // is floating point: This could happen if somebody put padding + // in the structure. if (idx == 0) in_gpr = false; else { @@ -819,9 +817,9 @@ } } - // These two tests are just sanity checks. If I somehow get the - // type calculation wrong above it is better to just return nothing - // than to assert or crash. + // These two tests are just sanity checks. If I somehow get the type + // calculation wrong above it is better to just return nothing than to + // assert or crash. if (!copy_from_extractor) return return_valobj_sp; if (copy_from_offset + field_byte_width > @@ -845,9 +843,8 @@ // FIXME: This is just taking a guess, r3 may very well no longer hold the // return storage location. // If we are going to do this right, when we make a new frame we should - // check to see if it uses a memory - // return, and if we are at the first instruction and if so stash away the - // return location. Then we would + // check to see if it uses a memory return, and if we are at the first + // instruction and if so stash away the return location. Then we would // only return the memory return value if we know it is valid. if (is_memory) { @@ -918,9 +915,9 @@ // See "Register Usage" in the // "System V Application Binary Interface" -// "64-bit PowerPC ELF Application Binary Interface Supplement" -// current version is 1.9 released 2004 at -// http://refspecs.linuxfoundation.org/ELF/ppc/PPC-elf64abi-1.9.pdf +// "64-bit PowerPC ELF Application Binary Interface Supplement" current version +// is 1.9 released 2004 at http://refspecs.linuxfoundation.org/ELF/ppc/PPC- +// elf64abi-1.9.pdf bool ABISysV_ppc::RegisterIsCalleeSaved(const RegisterInfo *reg_info) { if (reg_info) { Index: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp @@ -281,8 +281,8 @@ if (!value) return false; - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? CompilerType compiler_type = value->GetCompilerType(); if (!compiler_type) return false; @@ -380,8 +380,8 @@ if (!set_it_simple) { // Okay we've got a structure or something that doesn't fit in a simple - // register. - // We should figure out where it really goes, but we don't support this yet. + // register. We should figure out where it really goes, but we don't + // support this yet. error.SetErrorString("We only support setting simple integer and float " "return types at present."); } @@ -400,10 +400,10 @@ class ReturnValueExtractor { // This class represents a register, from which data may be extracted. // - // It may be constructed by directly specifying its index (where 0 is - // the first register used to return values) or by specifying the offset - // of a given struct field, in which case the appropriated register index - // will be calculated. + // It may be constructed by directly specifying its index (where 0 is the + // first register used to return values) or by specifying the offset of a + // given struct field, in which case the appropriated register index will be + // calculated. class Register { public: enum Type { @@ -720,8 +720,8 @@ } } - // Get the whole contents of vector registers and let the - // logic here arrange the data properly. + // Get the whole contents of vector registers and let the logic here + // arrange the data properly. RegisterValue vr_val[MAX_VRS]; Status error; @@ -740,8 +740,8 @@ } } - // The compiler generated code seems to always put the vector elements - // at the end of the vector register, in case they don't occupy all of it. + // The compiler generated code seems to always put the vector elements at + // the end of the vector register, in case they don't occupy all of it. // This offset variable handles this. uint32_t offs = 0; if (m_byte_size < vr_size) @@ -1025,8 +1025,8 @@ // See "Register Usage" in the // "System V Application Binary Interface" -// "64-bit PowerPC ELF Application Binary Interface Supplement" -// current version is 2 released 2015 at +// "64-bit PowerPC ELF Application Binary Interface Supplement" current version +// is 2 released 2015 at // https://members.openpowerfoundation.org/document/dl/576 bool ABISysV_ppc64::RegisterIsCalleeSaved(const RegisterInfo *reg_info) { if (reg_info) { Index: lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp @@ -380,8 +380,8 @@ if (!value) return false; - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? CompilerType compiler_type = value->GetCompilerType(); if (!compiler_type) return false; @@ -483,8 +483,8 @@ if (!set_it_simple) { // Okay we've got a structure or something that doesn't fit in a simple - // register. - // We should figure out where it really goes, but we don't support this yet. + // register. We should figure out where it really goes, but we don't + // support this yet. error.SetErrorString("We only support setting simple integer and float " "return types at present."); } @@ -618,9 +618,8 @@ // FIXME: This is just taking a guess, r2 may very well no longer hold the // return storage location. // If we are going to do this right, when we make a new frame we should - // check to see if it uses a memory - // return, and if we are at the first instruction and if so stash away the - // return location. Then we would + // check to see if it uses a memory return, and if we are at the first + // instruction and if so stash away the return location. Then we would // only return the memory return value if we know it is valid. unsigned r2_id = @@ -654,8 +653,8 @@ } bool ABISysV_s390x::CreateDefaultUnwindPlan(UnwindPlan &unwind_plan) { - // There's really no default way to unwind on s390x. - // Trust the .eh_frame CFI, which should always be good. + // There's really no default way to unwind on s390x. Trust the .eh_frame CFI, + // which should always be good. return false; } @@ -663,8 +662,8 @@ const RegisterInfo *reg_info, UnwindPlan::Row::RegisterLocation &unwind_regloc) { // If a volatile register is being requested, we don't want to forward the - // next frame's register contents - // up the stack -- the register is not retrievable at this frame. + // next frame's register contents up the stack -- the register is not + // retrievable at this frame. if (RegisterIsVolatile(reg_info)) { unwind_regloc.SetUndefined(); return true; Index: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp =================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp @@ -1267,8 +1267,8 @@ if (!value) return false; - // We currently only support extracting values with Clang QualTypes. - // Do we care about others? + // We currently only support extracting values with Clang QualTypes. Do we + // care about others? CompilerType compiler_type = value->GetCompilerType(); if (!compiler_type) return false; @@ -1371,8 +1371,8 @@ if (!set_it_simple) { // Okay we've got a structure or something that doesn't fit in a simple - // register. - // We should figure out where it really goes, but we don't support this yet. + // register. We should figure out where it really goes, but we don't + // support this yet. error.SetErrorString("We only support setting simple integer and float " "return types at present."); } @@ -1624,8 +1624,8 @@ idx, name, &field_bit_offset, nullptr, nullptr); const size_t field_bit_width = field_compiler_type.GetBitSize(&thread); - // if we don't know the size of the field (e.g. invalid type), just bail - // out + // if we don't know the size of the field (e.g. invalid type), just + // bail out if (field_bit_width == 0) break; @@ -1661,10 +1661,9 @@ copy_from_offset = integer_bytes - 8; integer_bytes += field_byte_width; } else { - // The last field didn't fit. I can't see how that would happen w/o - // the overall size being - // greater than 16 bytes. For now, return a nullptr return value - // object. + // The last field didn't fit. I can't see how that would happen + // w/o the overall size being greater than 16 bytes. For now, + // return a nullptr return value object. return return_valobj_sp; } } else if (field_compiler_type.IsFloatingPointType(count, is_complex)) { @@ -1683,10 +1682,9 @@ fp_bytes += field_byte_width; } else if (field_bit_width == 32) { // This one is kind of complicated. If we are in an "eightbyte" - // with another float, we'll - // be stuffed into an xmm register with it. If we are in an - // "eightbyte" with one or more ints, - // then we will be stuffed into the appropriate GPR with them. + // with another float, we'll be stuffed into an xmm register with + // it. If we are in an "eightbyte" with one or more ints, then we + // will be stuffed into the appropriate GPR with them. bool in_gpr; if (field_byte_offset % 8 == 0) { // We are at the beginning of one of the eightbytes, so check the @@ -1708,9 +1706,9 @@ } } } else if (field_byte_offset % 4 == 0) { - // We are inside of an eightbyte, so see if the field before us is - // floating point: - // This could happen if somebody put padding in the structure. + // We are inside of an eightbyte, so see if the field before us + // is floating point: This could happen if somebody put padding + // in the structure. if (idx == 0) in_gpr = false; else { @@ -1756,9 +1754,9 @@ } } - // These two tests are just sanity checks. If I somehow get the - // type calculation wrong above it is better to just return nothing - // than to assert or crash. + // These two tests are just sanity checks. If I somehow get the type + // calculation wrong above it is better to just return nothing than to + // assert or crash. if (!copy_from_extractor) return return_valobj_sp; if (copy_from_offset + field_byte_width > @@ -1782,9 +1780,8 @@ // FIXME: This is just taking a guess, rax may very well no longer hold the // return storage location. // If we are going to do this right, when we make a new frame we should - // check to see if it uses a memory - // return, and if we are at the first instruction and if so stash away the - // return location. Then we would + // check to see if it uses a memory return, and if we are at the first + // instruction and if so stash away the return location. Then we would // only return the memory return value if we know it is valid. if (is_memory) { @@ -1858,12 +1855,11 @@ // See "Register Usage" in the // "System V Application Binary Interface" -// "AMD64 Architecture Processor Supplement" -// (or "x86-64(tm) Architecture Processor Supplement" in earlier revisions) -// (this doc is also commonly referred to as the x86-64/AMD64 psABI) -// Edited by Michael Matz, Jan Hubicka, Andreas Jaeger, and Mark Mitchell -// current version is 0.99.6 released 2012-07-02 at -// http://refspecs.linuxfoundation.org/elf/x86-64-abi-0.99.pdf +// "AMD64 Architecture Processor Supplement" (or "x86-64(tm) Architecture +// Processor Supplement" in earlier revisions) (this doc is also commonly +// referred to as the x86-64/AMD64 psABI) Edited by Michael Matz, Jan Hubicka, +// Andreas Jaeger, and Mark Mitchell current version is 0.99.6 released +// 2012-07-02 at http://refspecs.linuxfoundation.org/elf/x86-64-abi-0.99.pdf // It's being revised & updated at https://github.com/hjl-tools/x86-psABI/ bool ABISysV_x86_64::RegisterIsCalleeSaved(const RegisterInfo *reg_info) { Index: lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp =================================================================== --- lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp +++ lldb/trunk/source/Plugins/Architecture/Arm/ArchitectureArm.cpp @@ -42,31 +42,31 @@ uint32_t ArchitectureArm::GetPluginVersion() { return 1; } void ArchitectureArm::OverrideStopInfo(Thread &thread) { - // We need to check if we are stopped in Thumb mode in a IT instruction - // and detect if the condition doesn't pass. If this is the case it means - // we won't actually execute this instruction. If this happens we need to - // clear the stop reason to no thread plans think we are stopped for a - // reason and the plans should keep going. + // We need to check if we are stopped in Thumb mode in a IT instruction and + // detect if the condition doesn't pass. If this is the case it means we + // won't actually execute this instruction. If this happens we need to clear + // the stop reason to no thread plans think we are stopped for a reason and + // the plans should keep going. // // We do this because when single stepping many ARM processes, debuggers - // often use the BVR/BCR registers that says "stop when the PC is not - // equal to its current value". This method of stepping means we can end - // up stopping on instructions inside an if/then block that wouldn't get - // executed. By fixing this we can stop the debugger from seeming like - // you stepped through both the "if" _and_ the "else" clause when source - // level stepping because the debugger stops regardless due to the BVR/BCR + // often use the BVR/BCR registers that says "stop when the PC is not equal + // to its current value". This method of stepping means we can end up + // stopping on instructions inside an if/then block that wouldn't get + // executed. By fixing this we can stop the debugger from seeming like you + // stepped through both the "if" _and_ the "else" clause when source level + // stepping because the debugger stops regardless due to the BVR/BCR // triggering a stop. // - // It also means we can set breakpoints on instructions inside an an - // if/then block and correctly skip them if we use the BKPT instruction. - // The ARM and Thumb BKPT instructions are unconditional even when executed - // in a Thumb IT block. + // It also means we can set breakpoints on instructions inside an an if/then + // block and correctly skip them if we use the BKPT instruction. The ARM and + // Thumb BKPT instructions are unconditional even when executed in a Thumb IT + // block. // - // If your debugger inserts software traps in ARM/Thumb code, it will - // need to use 16 and 32 bit instruction for 16 and 32 bit thumb - // instructions respectively. If your debugger inserts a 16 bit thumb - // trap on top of a 32 bit thumb instruction for an opcode that is inside - // an if/then, it will change the it/then to conditionally execute your + // If your debugger inserts software traps in ARM/Thumb code, it will need to + // use 16 and 32 bit instruction for 16 and 32 bit thumb instructions + // respectively. If your debugger inserts a 16 bit thumb trap on top of a 32 + // bit thumb instruction for an opcode that is inside an if/then, it will + // change the it/then to conditionally execute your // 16 bit trap and then cause your program to crash if it executes the // trailing 16 bits (the second half of the 32 bit thumb instruction you // partially overwrote). @@ -85,23 +85,20 @@ const uint32_t ISETSTATE = J << 1 | T; if (ISETSTATE == 0) { // NOTE: I am pretty sure we want to enable the code below -// that detects when we stop on an instruction in ARM mode -// that is conditional and the condition doesn't pass. This -// can happen if you set a breakpoint on an instruction that -// is conditional. We currently will _always_ stop on the -// instruction which is bad. You can also run into this while -// single stepping and you could appear to run code in the "if" -// and in the "else" clause because it would stop at all of the -// conditional instructions in both. -// In such cases, we really don't want to stop at this location. +// that detects when we stop on an instruction in ARM mode that is conditional +// and the condition doesn't pass. This can happen if you set a breakpoint on +// an instruction that is conditional. We currently will _always_ stop on the +// instruction which is bad. You can also run into this while single stepping +// and you could appear to run code in the "if" and in the "else" clause +// because it would stop at all of the conditional instructions in both. In +// such cases, we really don't want to stop at this location. // I will check with the lldb-dev list first before I enable this. #if 0 // ARM mode: check for condition on intsruction const addr_t pc = reg_ctx_sp->GetPC(); Status error; - // If we fail to read the opcode we will get UINT64_MAX as the - // result in "opcode" which we can use to detect if we read a - // valid opcode. + // If we fail to read the opcode we will get UINT64_MAX as the result in + // "opcode" which we can use to detect if we read a valid opcode. const uint64_t opcode = thread.GetProcess()->ReadUnsignedIntegerFromMemory(pc, 4, UINT64_MAX, error); if (opcode <= UINT32_MAX) { @@ -109,8 +106,8 @@ if (!ARMConditionPassed(condition, cpsr)) { // We ARE stopped on an ARM instruction whose condition doesn't - // pass so this instruction won't get executed. - // Regardless of why it stopped, we need to clear the stop info + // pass so this instruction won't get executed. Regardless of why + // it stopped, we need to clear the stop info thread.SetStopInfo (StopInfoSP()); } } Index: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp =================================================================== --- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp +++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp @@ -1082,8 +1082,7 @@ llvm::Triple triple = arch.GetTriple(); // So far the only supported flavor is "intel" on x86. The base class will - // set this - // correctly coming in. + // set this correctly coming in. if (triple.getArch() == llvm::Triple::x86 || triple.getArch() == llvm::Triple::x86_64) { if (m_flavor == "intel") { @@ -1107,12 +1106,10 @@ } // If no sub architecture specified then use the most recent arm architecture - // so the - // disassembler will return all instruction. Without it we will see a lot of - // unknow opcode - // in case the code uses instructions which are not available in the oldest - // arm version - // (used when no sub architecture is specified) + // so the disassembler will return all instruction. Without it we will see a + // lot of unknow opcode in case the code uses instructions which are not + // available in the oldest arm version (used when no sub architecture is + // specified) if (triple.getArch() == llvm::Triple::arm && triple.getSubArch() == llvm::Triple::NoSubArch) triple.setArchName("armv8.2a"); @@ -1186,14 +1183,14 @@ features_str += "+dspr2,"; } - // If any AArch64 variant, enable the ARMv8.2 ISA - // extensions so we can disassemble newer instructions. + // If any AArch64 variant, enable the ARMv8.2 ISA extensions so we can + // disassemble newer instructions. if (triple.getArch() == llvm::Triple::aarch64) features_str += "+v8.2a"; - // We use m_disasm_ap.get() to tell whether we are valid or not, - // so if this isn't good for some reason, - // we won't be valid and FindPlugin will fail and we won't get used. + // We use m_disasm_ap.get() to tell whether we are valid or not, so if this + // isn't good for some reason, we won't be valid and FindPlugin will fail and + // we won't get used. m_disasm_up = MCDisasmInstance::Create(triple_str, cpu, features_str.c_str(), flavor, *this); @@ -1391,8 +1388,8 @@ } } - // If the "value" address (the target address we're symbolicating) - // is inside the same SymbolContext as the current instruction pc + // If the "value" address (the target address we're symbolicating) is + // inside the same SymbolContext as the current instruction pc // (pc_so_addr), don't print the full function name - just print it // with DumpStyleNoFunctionName style, e.g. "<+36>". if (format_omitting_current_func_name) { @@ -1407,9 +1404,8 @@ if (!ss.GetString().empty()) { // If Address::Dump returned a multi-line description, most commonly - // seen when we - // have multiple levels of inlined functions at an address, only show - // the first line. + // seen when we have multiple levels of inlined functions at an + // address, only show the first line. std::string str = ss.GetString(); size_t first_eol_char = str.find_first_of("\r\n"); if (first_eol_char != std::string::npos) { Index: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -45,10 +45,10 @@ using namespace lldb; using namespace lldb_private; -// Progressively greater amounts of scanning we will allow -// For some targets very early in startup, we can't do any random reads of -// memory or we can crash the device -// so a setting is needed that can completely disable the KASLR scans. +// Progressively greater amounts of scanning we will allow For some targets +// very early in startup, we can't do any random reads of memory or we can +// crash the device so a setting is needed that can completely disable the +// KASLR scans. enum KASLRScanType { eKASLRScanNone = 0, // No reading into the inferior at all @@ -122,15 +122,15 @@ } //---------------------------------------------------------------------- -// Create an instance of this class. This function is filled into -// the plugin info class that gets handed out by the plugin factory and -// allows the lldb to instantiate an instance of this class. +// Create an instance of this class. This function is filled into the plugin +// info class that gets handed out by the plugin factory and allows the lldb to +// instantiate an instance of this class. //---------------------------------------------------------------------- DynamicLoader *DynamicLoaderDarwinKernel::CreateInstance(Process *process, bool force) { if (!force) { - // If the user provided an executable binary and it is not a kernel, - // this plugin should not create an instance. + // If the user provided an executable binary and it is not a kernel, this + // plugin should not create an instance. Module *exe_module = process->GetTarget().GetExecutableModulePointer(); if (exe_module) { ObjectFile *object_file = exe_module->GetObjectFile(); @@ -155,8 +155,8 @@ return NULL; } break; - // If we have triple like armv7-unknown-unknown, we should try looking for a - // Darwin kernel. + // If we have triple like armv7-unknown-unknown, we should try looking for + // a Darwin kernel. case llvm::Triple::UnknownOS: break; default: @@ -166,9 +166,8 @@ } // At this point if there is an ExecutableModule, it is a kernel and the - // Target is some variant of an Apple system. - // If the Process hasn't provided the kernel load address, we need to look - // around in memory to find it. + // Target is some variant of an Apple system. If the Process hasn't provided + // the kernel load address, we need to look around in memory to find it. const addr_t kernel_load_address = SearchForDarwinKernel(process); if (CheckForKernelImageAtAddress(kernel_load_address, process).IsValid()) { @@ -197,10 +196,9 @@ } //---------------------------------------------------------------------- -// Check if the kernel binary is loaded in memory without a slide. -// First verify that the ExecutableModule is a kernel before we proceed. -// Returns the address of the kernel if one was found, else -// LLDB_INVALID_ADDRESS. +// Check if the kernel binary is loaded in memory without a slide. First verify +// that the ExecutableModule is a kernel before we proceed. Returns the address +// of the kernel if one was found, else LLDB_INVALID_ADDRESS. //---------------------------------------------------------------------- lldb::addr_t DynamicLoaderDarwinKernel::SearchForKernelAtSameLoadAddr(Process *process) { @@ -229,10 +227,8 @@ //---------------------------------------------------------------------- // If the debug flag is included in the boot-args nvram setting, the kernel's -// load address -// will be noted in the lowglo page at a fixed address -// Returns the address of the kernel if one was found, else -// LLDB_INVALID_ADDRESS. +// load address will be noted in the lowglo page at a fixed address Returns the +// address of the kernel if one was found, else LLDB_INVALID_ADDRESS. //---------------------------------------------------------------------- lldb::addr_t DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints(Process *process) { @@ -282,8 +278,8 @@ } //---------------------------------------------------------------------- -// If the kernel is currently executing when lldb attaches, and we don't have -// a better way of finding the kernel's load address, try searching backwards +// If the kernel is currently executing when lldb attaches, and we don't have a +// better way of finding the kernel's load address, try searching backwards // from the current pc value looking for the kernel's Mach header in memory. // Returns the address of the kernel if one was found, else // LLDB_INVALID_ADDRESS. @@ -304,9 +300,8 @@ return LLDB_INVALID_ADDRESS; // The kernel will load at at one megabyte boundary (0x100000), or at that - // boundary plus - // an offset of one page (0x1000) or two, or four (0x4000), depending on the - // device. + // boundary plus an offset of one page (0x1000) or two, or four (0x4000), + // depending on the device. // Round the current pc down to the nearest one megabyte boundary - the place // where we will start searching. @@ -329,11 +324,10 @@ } //---------------------------------------------------------------------- -// Scan through the valid address range for a kernel binary. -// This is uselessly slow in 64-bit environments so we don't even try it. -// This scan is not enabled by default even for 32-bit targets. -// Returns the address of the kernel if one was found, else -// LLDB_INVALID_ADDRESS. +// Scan through the valid address range for a kernel binary. This is uselessly +// slow in 64-bit environments so we don't even try it. This scan is not +// enabled by default even for 32-bit targets. Returns the address of the +// kernel if one was found, else LLDB_INVALID_ADDRESS. //---------------------------------------------------------------------- lldb::addr_t DynamicLoaderDarwinKernel::SearchForKernelViaExhaustiveSearch( Process *process) { @@ -375,9 +369,8 @@ //---------------------------------------------------------------------- // Given an address in memory, look to see if there is a kernel image at that -// address. -// Returns a UUID; if a kernel was not found at that address, UUID.IsValid() -// will be false. +// address. Returns a UUID; if a kernel was not found at that address, +// UUID.IsValid() will be false. //---------------------------------------------------------------------- lldb_private::UUID DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress(lldb::addr_t addr, @@ -392,8 +385,8 @@ addr); // First try a quick test -- read the first 4 bytes and see if there is a - // valid Mach-O magic field there - // (the first field of the mach_header/mach_header_64 struct). + // valid Mach-O magic field there (the first field of the + // mach_header/mach_header_64 struct). Status read_error; uint8_t magicbuf[4]; @@ -630,10 +623,8 @@ } // Given the m_load_address from the kext summaries, and a UUID, try to create -// an in-memory -// Module at that address. Require that the MemoryModule have a matching UUID -// and detect -// if this MemoryModule is a kernel or a kext. +// an in-memory Module at that address. Require that the MemoryModule have a +// matching UUID and detect if this MemoryModule is a kernel or a kext. // // Returns true if m_memory_module_sp is now set to a valid Module. @@ -668,10 +659,8 @@ } // If this is a kext, and the kernel specified what UUID we should find at - // this - // load address, require that the memory module have a matching UUID or - // something - // has gone wrong and we should discard it. + // this load address, require that the memory module have a matching UUID or + // something has gone wrong and we should discard it. if (m_uuid.IsValid()) { if (m_uuid != memory_module_sp->GetUUID()) { if (log) { @@ -737,9 +726,8 @@ Target &target = process->GetTarget(); - // If we don't have / can't create a memory module for this kext, don't try to - // load it - we won't - // have the correct segment load addresses. + // If we don't have / can't create a memory module for this kext, don't try + // to load it - we won't have the correct segment load addresses. if (!ReadMemoryModule(process)) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); if (log) @@ -772,9 +760,8 @@ module_spec.GetUUID() = m_uuid; module_spec.GetArchitecture() = target.GetArchitecture(); - // For the kernel, we really do need an on-disk file copy of the binary to - // do anything useful. - // This will force a clal to + // For the kernel, we really do need an on-disk file copy of the binary + // to do anything useful. This will force a clal to if (IsKernel()) { if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) { if (module_spec.GetFileSpec().Exists()) { @@ -791,10 +778,8 @@ } // If the current platform is PlatformDarwinKernel, create a ModuleSpec - // with the filename set - // to be the bundle ID for this kext, e.g. - // "com.apple.filesystems.msdosfs", and ask the platform - // to find it. + // with the filename set to be the bundle ID for this kext, e.g. + // "com.apple.filesystems.msdosfs", and ask the platform to find it. PlatformSP platform_sp(target.GetPlatform()); if (!m_module_sp && platform_sp) { ConstString platform_name(platform_sp->GetPluginName()); @@ -828,8 +813,9 @@ } } - // If we managed to find a module, append it to the target's list of images. - // If we also have a memory module, require that they have matching UUIDs + // If we managed to find a module, append it to the target's list of + // images. If we also have a memory module, require that they have matching + // UUIDs if (m_module_sp) { bool uuid_match_ok = true; if (m_memory_module_sp) { @@ -871,15 +857,15 @@ SectionList *memory_section_list = memory_object_file->GetSectionList(); if (memory_section_list && ondisk_section_list) { const uint32_t num_ondisk_sections = ondisk_section_list->GetSize(); - // There may be CTF sections in the memory image so we can't - // always just compare the number of sections (which are actually - // segments in mach-o parlance) + // There may be CTF sections in the memory image so we can't always + // just compare the number of sections (which are actually segments + // in mach-o parlance) uint32_t sect_idx = 0; - // Use the memory_module's addresses for each section to set the - // file module's load address as appropriate. We don't want to use - // a single slide value for the entire kext - different segments may - // be slid different amounts by the kext loader. + // Use the memory_module's addresses for each section to set the file + // module's load address as appropriate. We don't want to use a + // single slide value for the entire kext - different segments may be + // slid different amounts by the kext loader. uint32_t num_sections_loaded = 0; for (sect_idx = 0; sect_idx < num_ondisk_sections; ++sect_idx) { @@ -969,10 +955,9 @@ } //---------------------------------------------------------------------- -// Load the kernel module and initialize the "m_kernel" member. Return -// true _only_ if the kernel is loaded the first time through (subsequent -// calls to this function should return false after the kernel has been -// already loaded). +// Load the kernel module and initialize the "m_kernel" member. Return true +// _only_ if the kernel is loaded the first time through (subsequent calls to +// this function should return false after the kernel has been already loaded). //---------------------------------------------------------------------- void DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded() { if (!m_kext_summary_header_ptr_addr.IsValid()) { @@ -996,9 +981,8 @@ m_kernel.SetLoadAddress(m_kernel_load_address); if (m_kernel.GetLoadAddress() == LLDB_INVALID_ADDRESS && m_kernel.GetModule()) { - // We didn't get a hint from the process, so we will - // try the kernel at the address that it exists at in - // the file if we have one + // We didn't get a hint from the process, so we will try the kernel at + // the address that it exists at in the file if we have one ObjectFile *kernel_object_file = m_kernel.GetModule()->GetObjectFile(); if (kernel_object_file) { addr_t load_address = @@ -1011,8 +995,7 @@ if (load_address != file_address) { // Don't accidentally relocate the kernel to the File address -- // the Load address has already been set to its actual in-memory - // address. - // Mark it as IsLoaded. + // address. Mark it as IsLoaded. m_kernel.SetProcessStopId(m_process->GetStopID()); } } else { @@ -1028,10 +1011,10 @@ } } - // The operating system plugin gets loaded and initialized in - // LoadImageUsingMemoryModule when we discover the kernel dSYM. For a - // core file in particular, that's the wrong place to do this, since - // we haven't fixed up the section addresses yet. So let's redo it here. + // The operating system plugin gets loaded and initialized in + // LoadImageUsingMemoryModule when we discover the kernel dSYM. For a core + // file in particular, that's the wrong place to do this, since we haven't + // fixed up the section addresses yet. So let's redo it here. LoadOperatingSystemPlugin(false); if (m_kernel.IsLoaded() && m_kernel.GetModule()) { @@ -1052,9 +1035,9 @@ //---------------------------------------------------------------------- // Static callback function that gets called when our DYLD notification -// breakpoint gets hit. We update all of our image infos and then -// let our super class DynamicLoader class decide if we should stop -// or not (based on global preference). +// breakpoint gets hit. We update all of our image infos and then let our super +// class DynamicLoader class decide if we should stop or not (based on global +// preference). //---------------------------------------------------------------------- bool DynamicLoaderDarwinKernel::BreakpointHitCallback( void *baton, StoppointCallbackContext *context, user_id_t break_id, @@ -1087,8 +1070,8 @@ const uint32_t addr_size = m_kernel.GetAddressByteSize(); const ByteOrder byte_order = m_kernel.GetByteOrder(); Status error; - // Read enough bytes for a "OSKextLoadedKextSummaryHeader" structure - // which is currently 4 uint32_t and a pointer. + // Read enough bytes for a "OSKextLoadedKextSummaryHeader" structure which + // is currently 4 uint32_t and a pointer. uint8_t buf[24]; DataExtractor data(buf, sizeof(buf), byte_order, addr_size); const size_t count = 4 * sizeof(uint32_t) + addr_size; @@ -1130,7 +1113,8 @@ return false; } } else { - // Versions less than 2 didn't have an entry size, it was hard coded + // Versions less than 2 didn't have an entry size, it was hard + // coded m_kext_summary_header.entry_size = KERNEL_MODULE_ENTRY_SIZE_VERSION_1; } @@ -1156,13 +1140,10 @@ } // We've either (a) just attached to a new kernel, or (b) the kexts-changed -// breakpoint was hit -// and we need to figure out what kexts have been added or removed. -// Read the kext summaries from the inferior kernel memory, compare them against -// the -// m_known_kexts vector and update the m_known_kexts vector as needed to keep in -// sync with the -// inferior. +// breakpoint was hit and we need to figure out what kexts have been added or +// removed. Read the kext summaries from the inferior kernel memory, compare +// them against the m_known_kexts vector and update the m_known_kexts vector as +// needed to keep in sync with the inferior. bool DynamicLoaderDarwinKernel::ParseKextSummaries( const Address &kext_summary_addr, uint32_t count) { @@ -1178,14 +1159,13 @@ return false; // read the plugin.dynamic-loader.darwin-kernel.load-kexts setting -- if the - // user requested no - // kext loading, don't print any messages about kexts & don't try to read - // them. + // user requested no kext loading, don't print any messages about kexts & + // don't try to read them. const bool load_kexts = GetGlobalProperties()->GetLoadKexts(); // By default, all kexts we've loaded in the past are marked as "remove" and - // all of the kexts - // we just found out about from ReadKextSummaries are marked as "add". + // all of the kexts we just found out about from ReadKextSummaries are marked + // as "add". std::vector to_be_removed(m_known_kexts.size(), true); std::vector to_be_added(count, true); @@ -1195,8 +1175,8 @@ const uint32_t new_kexts_size = kext_summaries.size(); const uint32_t old_kexts_size = m_known_kexts.size(); - // The m_known_kexts vector may have entries that have been Cleared, - // or are a kernel. + // The m_known_kexts vector may have entries that have been Cleared, or are a + // kernel. for (uint32_t old_kext = 0; old_kext < old_kexts_size; old_kext++) { bool ignore = false; KextImageInfo &image_info = m_known_kexts[old_kext]; @@ -1229,10 +1209,9 @@ break; } } - // If this "kext" entry is actually an alias for the kernel -- - // the kext was compiled into the kernel or something -- then - // we don't want to load the kernel's text section at a different - // address. Ignore this kext entry. + // If this "kext" entry is actually an alias for the kernel -- the kext was + // compiled into the kernel or something -- then we don't want to load the + // kernel's text section at a different address. Ignore this kext entry. if (kext_summaries[new_kext].GetUUID().IsValid() && m_kernel.GetUUID().IsValid() && kext_summaries[new_kext].GetUUID() == m_kernel.GetUUID()) { @@ -1322,9 +1301,8 @@ s->Printf("."); image_info.Clear(); // should pull it out of the KextImageInfos vector but that would - // mutate the list and invalidate - // the to_be_removed bool vector; leaving it in place once Cleared() - // is relatively harmless. + // mutate the list and invalidate the to_be_removed bool vector; + // leaving it in place once Cleared() is relatively harmless. } } m_process->GetTarget().ModulesDidUnload(unloaded_module_list, false); @@ -1433,8 +1411,8 @@ } //---------------------------------------------------------------------- -// Dump the _dyld_all_image_infos members and all current image infos -// that we have parsed to the file handle provided. +// Dump the _dyld_all_image_infos members and all current image infos that we +// have parsed to the file handle provided. //---------------------------------------------------------------------- void DynamicLoaderDarwinKernel::PutToLog(Log *log) const { if (log == NULL) Index: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -127,8 +127,8 @@ executable = GetTargetExecutable(); - // Find the difference between the desired load address in the elf file - // and the real load address in memory + // Find the difference between the desired load address in the elf file and + // the real load address in memory load_offset = ComputeLoadOffset(); // Check that there is a valid executable @@ -157,10 +157,10 @@ // Callback for the target to give it the loaded module list m_process->GetTarget().ModulesDidLoad(module_list); - // Try to set a breakpoint at the rendezvous breakpoint. - // DidLaunch uses ProbeEntry() instead. That sets a breakpoint, - // at the dyld breakpoint address, with a callback so that when hit, - // the dyld structure can be parsed. + // Try to set a breakpoint at the rendezvous breakpoint. DidLaunch uses + // ProbeEntry() instead. That sets a breakpoint, at the dyld breakpoint + // address, with a callback so that when hit, the dyld structure can be + // parsed. if (!SetRendezvousBreakpoint()) { // fail } @@ -203,8 +203,8 @@ // TODO: What case is this code used? executable = target.GetSharedModule(module_spec); if (executable.get() != target.GetExecutableModulePointer()) { - // Don't load dependent images since we are in dyld where we will know - // and find out about all images that are loaded + // Don't load dependent images since we are in dyld where we will know and + // find out about all images that are loaded const bool get_dependent_images = false; target.SetExecutableModule(executable, get_dependent_images); } @@ -270,9 +270,8 @@ // This is the original code, which want to look in the rendezvous structure // to find the breakpoint address. Its backwards for us, since we can easily - // find the breakpoint address, since it is exported in our executable. - // We however know that we cant read the Rendezvous structure until we have - // hit + // find the breakpoint address, since it is exported in our executable. We + // however know that we cant read the Rendezvous structure until we have hit // the breakpoint once. const ConstString dyldBpName("_rtld_debug_state"); addr_t break_addr = findSymbolAddress(m_process, dyldBpName); @@ -326,8 +325,8 @@ DynamicLoaderHexagonDYLD *dyld_instance = nullptr; dyld_instance = static_cast(baton); - // if the dyld_instance is still not valid then - // try to locate it on the symbol table + // if the dyld_instance is still not valid then try to locate it on the + // symbol table if (!dyld_instance->m_rendezvous.IsValid()) { Process *proc = dyld_instance->m_process; @@ -480,8 +479,8 @@ return; } - // The rendezvous class doesn't enumerate the main module, so track - // that ourselves here. + // The rendezvous class doesn't enumerate the main module, so track that + // ourselves here. ModuleSP executable = GetTargetExecutable(); m_loaded_modules[executable] = m_rendezvous.GetLinkMapAddress(); @@ -517,12 +516,11 @@ return 0; } -// Here we must try to read the entry point directly from -// the elf header. This is possible if the process is not -// relocatable or dynamically linked. +// Here we must try to read the entry point directly from the elf header. This +// is possible if the process is not relocatable or dynamically linked. // -// an alternative is to look at the PC if we can be sure -// that we have connected when the process is at the entry point. +// an alternative is to look at the PC if we can be sure that we have connected +// when the process is at the entry point. // I dont think that is reliable for us. addr_t DynamicLoaderHexagonDYLD::GetEntryPoint() { if (m_entry_point != LLDB_INVALID_ADDRESS) Index: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp @@ -115,8 +115,8 @@ if (m_current.map_addr == 0) return false; - // When the previous and current states are consistent this is the first - // time we have been asked to update. Just take a snapshot of the currently + // When the previous and current states are consistent this is the first time + // we have been asked to update. Just take a snapshot of the currently // loaded modules. if (m_previous.state == eConsistent && m_current.state == eConsistent) return TakeSnapshot(m_soentries); @@ -126,8 +126,8 @@ if (m_current.state == eAdd || m_current.state == eDelete) { // this is a fudge so that we can clear the assert below. m_previous.state = eConsistent; - // We hit this assert on the 2nd run of this function after running the calc - // example + // We hit this assert on the 2nd run of this function after running the + // calc example assert(m_previous.state == eConsistent); m_soentries.clear(); m_added_soentries.clear(); @@ -159,9 +159,9 @@ if (!ReadSOEntryFromMemory(cursor, entry)) return false; - // Only add shared libraries and not the executable. - // On Linux this is indicated by an empty path in the entry. - // On FreeBSD it is the name of the executable. + // Only add shared libraries and not the executable. On Linux this is + // indicated by an empty path in the entry. On FreeBSD it is the name of + // the executable. if (entry.path.empty() || ::strcmp(entry.path.c_str(), m_exe_path) == 0) continue; @@ -204,9 +204,9 @@ if (!ReadSOEntryFromMemory(cursor, entry)) return false; - // Only add shared libraries and not the executable. - // On Linux this is indicated by an empty path in the entry. - // On FreeBSD it is the name of the executable. + // Only add shared libraries and not the executable. On Linux this is + // indicated by an empty path in the entry. On FreeBSD it is the name of + // the executable. if (entry.path.empty() || ::strcmp(entry.path.c_str(), m_exe_path) == 0) continue; Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -112,8 +112,8 @@ if (module_sp && !module_spec.GetUUID().IsValid() && !module_sp->GetUUID().IsValid()) { - // No UUID, we must rely upon the cached module modification - // time and the modification time of the file on disk + // No UUID, we must rely upon the cached module modification time and the + // modification time of the file on disk if (module_sp->GetModificationTime() != FileSystem::GetModificationTime(module_sp->GetFileSpec())) module_sp.reset(); @@ -198,8 +198,7 @@ ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i); // Don't remove dyld - else we'll lose our breakpoint notifying us about - // libraries - // being re-loaded... + // libraries being re-loaded... if (module_sp.get() != nullptr && module_sp.get() != dyld_sp.get()) { UnloadSections(module_sp); unloaded_modules_list.Append(module_sp); @@ -219,8 +218,8 @@ } //---------------------------------------------------------------------- -// Update the load addresses for all segments in MODULE using the -// updated INFO that is passed in. +// Update the load addresses for all segments in MODULE using the updated INFO +// that is passed in. //---------------------------------------------------------------------- bool DynamicLoaderDarwin::UpdateImageLoadAddress(Module *module, ImageInfo &info) { @@ -231,13 +230,12 @@ SectionList *section_list = image_object_file->GetSectionList(); if (section_list) { std::vector inaccessible_segment_indexes; - // We now know the slide amount, so go through all sections - // and update the load addresses with the correct values. + // We now know the slide amount, so go through all sections and update + // the load addresses with the correct values. const size_t num_segments = info.segments.size(); for (size_t i = 0; i < num_segments; ++i) { - // Only load a segment if it has protections. Things like - // __PAGEZERO don't have any protections, and they shouldn't - // be slid + // Only load a segment if it has protections. Things like __PAGEZERO + // don't have any protections, and they shouldn't be slid SectionSP section_sp( section_list->FindSectionByName(info.segments[i].name)); @@ -249,10 +247,10 @@ static ConstString g_section_name_LINKEDIT("__LINKEDIT"); if (section_sp) { - // __LINKEDIT sections from files in the shared cache - // can overlap so check to see what the segment name is - // and pass "false" so we don't warn of overlapping - // "Section" objects, and "true" for all other sections. + // __LINKEDIT sections from files in the shared cache can overlap + // so check to see what the segment name is and pass "false" so + // we don't warn of overlapping "Section" objects, and "true" for + // all other sections. const bool warn_multiple = section_sp->GetName() != g_section_name_LINKEDIT; @@ -270,13 +268,12 @@ } } - // If the loaded the file (it changed) and we have segments that - // are not readable or writeable, add them to the invalid memory - // region cache for the process. This will typically only be - // the __PAGEZERO segment in the main executable. We might be able - // to apply this more generally to more sections that have no - // protections in the future, but for now we are going to just - // do __PAGEZERO. + // If the loaded the file (it changed) and we have segments that are + // not readable or writeable, add them to the invalid memory region + // cache for the process. This will typically only be the __PAGEZERO + // segment in the main executable. We might be able to apply this more + // generally to more sections that have no protections in the future, + // but for now we are going to just do __PAGEZERO. if (changed && !inaccessible_segment_indexes.empty()) { for (uint32_t i = 0; i < inaccessible_segment_indexes.size(); ++i) { const uint32_t seg_idx = inaccessible_segment_indexes[i]; @@ -344,8 +341,7 @@ } // Given a JSON dictionary (from debugserver, most likely) of binary images -// loaded in the inferior -// process, add the images to the ImageInfo collection. +// loaded in the inferior process, add the images to the ImageInfo collection. bool DynamicLoaderDarwin::JSONImageInformationIntoImageInfo( StructuredData::ObjectSP image_details, @@ -412,8 +408,7 @@ } // Fields that aren't used by DynamicLoaderDarwin so debugserver doesn't - // currently send them - // in the reply. + // currently send them in the reply. if (mh->HasKey("flags")) image_infos[i].header.flags = @@ -454,8 +449,7 @@ seg->GetValueForKey("maxprot")->GetAsInteger()->GetValue(); // Fields that aren't used by DynamicLoaderDarwin so debugserver doesn't - // currently send them - // in the reply. + // currently send them in the reply. if (seg->HasKey("initprot")) segment.initprot = @@ -481,25 +475,23 @@ image_infos[i].uuid.SetFromStringRef( image->GetValueForKey("uuid")->GetAsString()->GetValue()); - // All sections listed in the dyld image info structure will all - // either be fixed up already, or they will all be off by a single - // slide amount that is determined by finding the first segment - // that is at file offset zero which also has bytes (a file size - // that is greater than zero) in the object file. + // All sections listed in the dyld image info structure will all either be + // fixed up already, or they will all be off by a single slide amount that + // is determined by finding the first segment that is at file offset zero + // which also has bytes (a file size that is greater than zero) in the + // object file. // Determine the slide amount (if any) const size_t num_sections = image_infos[i].segments.size(); for (size_t k = 0; k < num_sections; ++k) { - // Iterate through the object file sections to find the - // first section that starts of file offset zero and that - // has bytes in the file... + // Iterate through the object file sections to find the first section + // that starts of file offset zero and that has bytes in the file... if ((image_infos[i].segments[k].fileoff == 0 && image_infos[i].segments[k].filesize > 0) || (image_infos[i].segments[k].name == ConstString("__TEXT"))) { image_infos[i].slide = image_infos[i].address - image_infos[i].segments[k].vmaddr; - // We have found the slide amount, so we can exit - // this for loop. + // We have found the slide amount, so we can exit this for loop. break; } } @@ -520,16 +512,15 @@ const size_t image_infos_size = image_infos.size(); for (size_t i = 0; i < image_infos_size; i++) { if (image_infos[i].header.filetype == llvm::MachO::MH_DYLINKER) { - // In a "simulator" process (an x86 process that is ios/tvos/watchos) - // we will have two dyld modules -- a "dyld" that we want to keep track - // of, - // and a "dyld_sim" which we don't need to keep track of here. - // If the target is an x86 system and the OS of the dyld binary is + // In a "simulator" process (an x86 process that is ios/tvos/watchos) we + // will have two dyld modules -- a "dyld" that we want to keep track of, + // and a "dyld_sim" which we don't need to keep track of here. If the + // target is an x86 system and the OS of the dyld binary is // ios/tvos/watchos, then we are looking at dyld_sym. - // debugserver has only recently (late 2016) started sending up the - // os type for each binary it sees -- so if we don't have an os - // type, use a filename check as our next best guess. + // debugserver has only recently (late 2016) started sending up the os + // type for each binary it sees -- so if we don't have an os type, use a + // filename check as our next best guess. if (image_infos[i].os_type == llvm::Triple::OSType::UnknownOS) { if (image_infos[i].file_spec.GetFilename() != g_dyld_sim_filename) { dyld_idx = i; @@ -543,7 +534,8 @@ } } else { - // catch-all for any other environment -- trust that dyld is actually dyld + // catch-all for any other environment -- trust that dyld is actually + // dyld dyld_idx = i; } } else if (image_infos[i].header.filetype == llvm::MachO::MH_EXECUTE) { @@ -669,11 +661,10 @@ } } - // UpdateImageLoadAddress will return true if any segments - // change load address. We need to check this so we don't - // mention that all loaded shared libraries are newly loaded - // each time we hit out dyld breakpoint since dyld will list all - // shared libraries each time. + // UpdateImageLoadAddress will return true if any segments change load + // address. We need to check this so we don't mention that all loaded + // shared libraries are newly loaded each time we hit out dyld breakpoint + // since dyld will list all shared libraries each time. if (UpdateImageLoadAddress(image_module_sp.get(), image_infos[idx])) { target_images.AppendIfNeeded(image_module_sp); loaded_module_list.AppendIfNeeded(image_module_sp); @@ -692,12 +683,11 @@ //---------------------------------------------------------------------- // On Mac OS X libobjc (the Objective-C runtime) has several critical dispatch -// functions written in hand-written assembly, and also have hand-written unwind -// information in the eh_frame section. Normally we prefer analyzing the -// assembly instructions of a currently executing frame to unwind from that -// frame -- -// but on hand-written functions this profiling can fail. We should use the -// eh_frame instructions for these functions all the time. +// functions written in hand-written assembly, and also have hand-written +// unwind information in the eh_frame section. Normally we prefer analyzing +// the assembly instructions of a currently executing frame to unwind from that +// frame -- but on hand-written functions this profiling can fail. We should +// use the eh_frame instructions for these functions all the time. // // As an aside, it would be better if the eh_frame entries had a flag (or were // extensible so they could have an Apple-specific flag) which indicates that @@ -817,8 +807,8 @@ break; case eStateStopped: - // Keep trying find dyld and set our notification breakpoint each time - // we stop until we succeed + // Keep trying find dyld and set our notification breakpoint each time we + // stop until we succeed if (!DidSetNotificationBreakpoint() && m_process->IsAlive()) { if (NeedToDoInitialImageFetch()) DoInitialImageFetch(); @@ -956,8 +946,8 @@ } if (addresses.size() > 0) { - // First check whether any of the addresses point to Indirect symbols, and - // if they do, resolve them: + // First check whether any of the addresses point to Indirect symbols, + // and if they do, resolve them: std::vector load_addrs; for (Address address : addresses) { Symbol *symbol = address.CalculateSymbolContextSymbol(); @@ -1073,10 +1063,10 @@ const lldb::addr_t pthread_key = data.GetAddress(&offset); const lldb::addr_t tls_offset = data.GetAddress(&offset); if (pthread_key != 0) { - // First check to see if we have already figured out the location - // of TLS data for the pthread_key on a specific thread yet. If we - // have we can re-use it since its location will not change unless - // the process execs. + // First check to see if we have already figured out the location of + // TLS data for the pthread_key on a specific thread yet. If we have we + // can re-use it since its location will not change unless the process + // execs. const tid_t tid = thread_sp->GetID(); auto tid_pos = m_tid_to_tls_map.find(tid); if (tid_pos != m_tid_to_tls_map.end()) { Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -29,9 +29,9 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Create an instance of this class. This function is filled into -// the plugin info class that gets handed out by the plugin factory and -// allows the lldb to instantiate an instance of this class. +// Create an instance of this class. This function is filled into the plugin +// info class that gets handed out by the plugin factory and allows the lldb to +// instantiate an instance of this class. //---------------------------------------------------------------------- DynamicLoader *DynamicLoaderMacOS::CreateInstance(Process *process, bool force) { @@ -144,17 +144,18 @@ } //---------------------------------------------------------------------- -// Try and figure out where dyld is by first asking the Process -// if it knows (which currently calls down in the lldb::Process -// to get the DYLD info (available on SnowLeopard only). If that fails, -// then check in the default addresses. +// Try and figure out where dyld is by first asking the Process if it knows +// (which currently calls down in the lldb::Process to get the DYLD info +// (available on SnowLeopard only). If that fails, then check in the default +// addresses. //---------------------------------------------------------------------- void DynamicLoaderMacOS::DoInitialImageFetch() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); - // Remove any binaries we pre-loaded in the Target before launching/attaching. - // If the same binaries are present in the process, we'll get them from the - // shared module cache, we won't need to re-load them from disk. + // Remove any binaries we pre-loaded in the Target before + // launching/attaching. If the same binaries are present in the process, + // we'll get them from the shared module cache, we won't need to re-load them + // from disk. UnloadAllImages(); StructuredData::ObjectSP all_image_info_json_sp( @@ -184,9 +185,9 @@ //---------------------------------------------------------------------- // Static callback function that gets called when our DYLD notification -// breakpoint gets hit. We update all of our image infos and then -// let our super class DynamicLoader class decide if we should stop -// or not (based on global preference). +// breakpoint gets hit. We update all of our image infos and then let our super +// class DynamicLoader class decide if we should stop or not (based on global +// preference). //---------------------------------------------------------------------- bool DynamicLoaderMacOS::NotifyBreakpointHit(void *baton, StoppointCallbackContext *context, @@ -194,11 +195,10 @@ lldb::user_id_t break_loc_id) { // Let the event know that the images have changed // DYLD passes three arguments to the notification breakpoint. - // Arg1: enum dyld_notify_mode mode - 0 = adding, 1 = removing, 2 = remove all - // Arg2: unsigned long icount - Number of shared libraries - // added/removed - // Arg3: uint64_t mach_headers[] - Array of load addresses of binaries - // added/removed + // Arg1: enum dyld_notify_mode mode - 0 = adding, 1 = removing, 2 = remove + // all Arg2: unsigned long icount - Number of shared libraries + // added/removed Arg3: uint64_t mach_headers[] - Array of load addresses + // of binaries added/removed DynamicLoaderMacOS *dyld_instance = (DynamicLoaderMacOS *)baton; @@ -328,8 +328,8 @@ } } -// Dump the _dyld_all_image_infos members and all current image infos -// that we have parsed to the file handle provided. +// Dump the _dyld_all_image_infos members and all current image infos that we +// have parsed to the file handle provided. //---------------------------------------------------------------------- void DynamicLoaderMacOS::PutToLog(Log *log) const { if (log == NULL) @@ -432,9 +432,9 @@ } } - // Default assumption is that it is OK to load images. - // Only say that we cannot load images if we find the symbol in libdyld and it - // indicates that we cannot. + // Default assumption is that it is OK to load images. Only say that we + // cannot load images if we find the symbol in libdyld and it indicates that + // we cannot. if (symbol_address != LLDB_INVALID_ADDRESS) { { @@ -445,11 +445,11 @@ } } } else { - // If we were unable to find _dyld_global_lock_held in any modules, or it is - // not loaded into memory yet, we may be at process startup (sitting - // at _dyld_start) - so we should not allow dlopen calls. - // But if we found more than one module then we are clearly past _dyld_start - // so in that case we'll default to "it's safe". + // If we were unable to find _dyld_global_lock_held in any modules, or it + // is not loaded into memory yet, we may be at process startup (sitting at + // _dyld_start) - so we should not allow dlopen calls. But if we found more + // than one module then we are clearly past _dyld_start so in that case + // we'll default to "it's safe". if (num_modules <= 1) error.SetErrorString("could not find the dyld library or " "the dyld lock symbol"); @@ -472,7 +472,9 @@ info_dict = info->GetAsDictionary(); } - // {"shared_cache_base_address":140735683125248,"shared_cache_uuid":"DDB8D70C-C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false} + // {"shared_cache_base_address":140735683125248,"shared_cache_uuid + // ":"DDB8D70C- + // C9A2-3561-B2C8-BE48A4F33F96","no_shared_cache":false,"shared_cache_private_cache":false} if (info_dict && info_dict->HasKey("shared_cache_uuid") && info_dict->HasKey("no_shared_cache") && Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -49,9 +49,9 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Create an instance of this class. This function is filled into -// the plugin info class that gets handed out by the plugin factory and -// allows the lldb to instantiate an instance of this class. +// Create an instance of this class. This function is filled into the plugin +// info class that gets handed out by the plugin factory and allows the lldb to +// instantiate an instance of this class. //---------------------------------------------------------------------- DynamicLoader *DynamicLoaderMacOSXDYLD::CreateInstance(Process *process, bool force) { @@ -123,17 +123,18 @@ const addr_t shlib_addr = m_process->GetImageInfoAddress(); if (m_process_image_addr_is_all_images_infos == true && shlib_addr != m_dyld_all_image_infos_addr) { - // The image info address from the process is the 'dyld_all_image_infos' - // address and it has changed. + // The image info address from the process is the + // 'dyld_all_image_infos' address and it has changed. did_exec = true; } else if (m_process_image_addr_is_all_images_infos == false && shlib_addr == m_dyld.address) { - // The image info address from the process is the mach_header - // address for dyld and it has changed. + // The image info address from the process is the mach_header address + // for dyld and it has changed. did_exec = true; } else { // ASLR might be disabled and dyld could have ended up in the same - // location. We should try and detect if we are stopped at '_dyld_start' + // location. We should try and detect if we are stopped at + // '_dyld_start' ThreadSP thread_sp(m_process->GetThreadList().GetThreadAtIndex(0)); if (thread_sp) { lldb::StackFrameSP frame_sp(thread_sp->GetStackFrameAtIndex(0)); @@ -185,16 +186,15 @@ } //---------------------------------------------------------------------- -// Try and figure out where dyld is by first asking the Process -// if it knows (which currently calls down in the lldb::Process -// to get the DYLD info (available on SnowLeopard only). If that fails, -// then check in the default addresses. +// Try and figure out where dyld is by first asking the Process if it knows +// (which currently calls down in the lldb::Process to get the DYLD info +// (available on SnowLeopard only). If that fails, then check in the default +// addresses. //---------------------------------------------------------------------- void DynamicLoaderMacOSXDYLD::DoInitialImageFetch() { if (m_dyld_all_image_infos_addr == LLDB_INVALID_ADDRESS) { - // Check the image info addr as it might point to the - // mach header for dyld, or it might point to the - // dyld_all_image_infos struct + // Check the image info addr as it might point to the mach header for dyld, + // or it might point to the dyld_all_image_infos struct const addr_t shlib_addr = m_process->GetImageInfoAddress(); if (shlib_addr != LLDB_INVALID_ADDRESS) { ByteOrder byte_order = @@ -255,8 +255,7 @@ } //---------------------------------------------------------------------- -// Assume that dyld is in memory at ADDR and try to parse it's load -// commands +// Assume that dyld is in memory at ADDR and try to parse it's load commands //---------------------------------------------------------------------- bool DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback( lldb::addr_t addr) { @@ -287,10 +286,10 @@ // Update all image infos InitializeFromAllImageInfos(); - // If we didn't have an executable before, but now we do, then the - // dyld module shared pointer might be unique and we may need to add - // it again (since Target::SetExecutableModule() will clear the - // images). So append the dyld module back to the list if it is + // If we didn't have an executable before, but now we do, then the dyld + // module shared pointer might be unique and we may need to add it again + // (since Target::SetExecutableModule() will clear the images). So append + // the dyld module back to the list if it is /// unique! if (dyld_module_sp) { target.GetImages().AppendIfNeeded(dyld_module_sp); @@ -315,18 +314,18 @@ //---------------------------------------------------------------------- // Static callback function that gets called when our DYLD notification -// breakpoint gets hit. We update all of our image infos and then -// let our super class DynamicLoader class decide if we should stop -// or not (based on global preference). +// breakpoint gets hit. We update all of our image infos and then let our super +// class DynamicLoader class decide if we should stop or not (based on global +// preference). //---------------------------------------------------------------------- bool DynamicLoaderMacOSXDYLD::NotifyBreakpointHit( void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id) { // Let the event know that the images have changed // DYLD passes three arguments to the notification breakpoint. - // Arg1: enum dyld_image_mode mode - 0 = adding, 1 = removing - // Arg2: uint32_t infoCount - Number of shared libraries added - // Arg3: dyld_image_info info[] - Array of structs of the form: + // Arg1: enum dyld_image_mode mode - 0 = adding, 1 = removing Arg2: uint32_t + // infoCount - Number of shared libraries added Arg3: dyld_image_info + // info[] - Array of structs of the form: // const struct mach_header // *imageLoadAddress // const char *imageFilePath @@ -335,11 +334,10 @@ DynamicLoaderMacOSXDYLD *dyld_instance = (DynamicLoaderMacOSXDYLD *)baton; // First step is to see if we've already initialized the all image infos. If - // we haven't then this function - // will do so and return true. In the course of initializing the - // all_image_infos it will read the complete - // current state, so we don't need to figure out what has changed from the - // data passed in to us. + // we haven't then this function will do so and return true. In the course + // of initializing the all_image_infos it will read the complete current + // state, so we don't need to figure out what has changed from the data + // passed in to us. ExecutionContext exe_ctx(context->exe_ctx_ref); Process *process = exe_ctx.GetProcessPtr(); @@ -388,11 +386,9 @@ argument_values.GetValueAtIndex(1)->GetScalar().UInt(-1); if (image_infos_count != static_cast(-1)) { // Got the number added, now go through the array of added elements, - // putting out the mach header - // address, and adding the image. - // Note, I'm not putting in logging here, since the AddModules & - // RemoveModules functions do - // all the logging internally. + // putting out the mach header address, and adding the image. Note, + // I'm not putting in logging here, since the AddModules & + // RemoveModules functions do all the logging internally. lldb::addr_t image_infos_addr = argument_values.GetValueAtIndex(2)->GetScalar().ULongLong(); @@ -467,12 +463,12 @@ if (m_process->ReadMemory(m_dyld_all_image_infos_addr, buf, 4, error) == 4) { m_dyld_all_image_infos.version = data.GetU32(&offset); - // If anything in the high byte is set, we probably got the byte - // order incorrect (the process might not have it set correctly - // yet due to attaching to a program without a specified file). + // If anything in the high byte is set, we probably got the byte order + // incorrect (the process might not have it set correctly yet due to + // attaching to a program without a specified file). if (m_dyld_all_image_infos.version & 0xff000000) { - // We have guessed the wrong byte order. Swap it and try - // reading the version again. + // We have guessed the wrong byte order. Swap it and try reading the + // version again. if (byte_order == eByteOrderLittle) byte_order = eByteOrderBig; else @@ -508,21 +504,17 @@ uint64_t dyld_all_image_infos_addr = data.GetPointer(&offset); // When we started, we were given the actual address of the - // all_image_infos - // struct (probably via TASK_DYLD_INFO) in memory - this address is - // stored in - // m_dyld_all_image_infos_addr and is the most accurate address we have. + // all_image_infos struct (probably via TASK_DYLD_INFO) in memory - + // this address is stored in m_dyld_all_image_infos_addr and is the + // most accurate address we have. // We read the dyld_all_image_infos struct from memory; it contains its - // own address. - // If the address in the struct does not match the actual address, - // the dyld we're looking at has been loaded at a different location - // (slid) from - // where it intended to load. The addresses in the dyld_all_image_infos - // struct - // are the original, non-slid addresses, and need to be adjusted. Most - // importantly - // the address of dyld and the notification address need to be adjusted. + // own address. If the address in the struct does not match the actual + // address, the dyld we're looking at has been loaded at a different + // location (slid) from where it intended to load. The addresses in + // the dyld_all_image_infos struct are the original, non-slid + // addresses, and need to be adjusted. Most importantly the address of + // dyld and the notification address need to be adjusted. if (dyld_all_image_infos_addr != m_dyld_all_image_infos_addr) { uint64_t image_infos_offset = @@ -615,14 +607,13 @@ image_infos[idx].PutToLog(log); } - // Remove this image_infos from the m_all_image_infos. We do the comparison - // by address - // rather than by file spec because we can have many modules with the same - // "file spec" in the - // case that they are modules loaded from memory. + // Remove this image_infos from the m_all_image_infos. We do the + // comparison by address rather than by file spec because we can have many + // modules with the same "file spec" in the case that they are modules + // loaded from memory. // - // Also copy over the uuid from the old entry to the removed entry so we can - // use it to lookup the module in the module list. + // Also copy over the uuid from the old entry to the removed entry so we + // can use it to lookup the module in the module list. ImageInfo::collection::iterator pos, end = m_dyld_image_infos.end(); for (pos = m_dyld_image_infos.begin(); pos != end; pos++) { @@ -630,8 +621,7 @@ image_infos[idx].uuid = (*pos).uuid; // Add the module from this image_info to the "unloaded_module_list". - // We'll remove them all at - // one go later on. + // We'll remove them all at one go later on. ModuleSP unload_image_module_sp( FindTargetModuleForImageInfo(image_infos[idx], false, NULL)); @@ -713,11 +703,10 @@ } //---------------------------------------------------------------------- -// If we have found where the "_dyld_all_image_infos" lives in memory, -// read the current info from it, and then update all image load -// addresses (or lack thereof). Only do this if this is the first time -// we're reading the dyld infos. Return true if we actually read anything, -// and false otherwise. +// If we have found where the "_dyld_all_image_infos" lives in memory, read the +// current info from it, and then update all image load addresses (or lack +// thereof). Only do this if this is the first time we're reading the dyld +// infos. Return true if we actually read anything, and false otherwise. //---------------------------------------------------------------------- bool DynamicLoaderMacOSXDYLD::InitializeFromAllImageInfos() { Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER)); @@ -748,14 +737,11 @@ } // Now we have one more bit of business. If there is a library left in the - // images for our target that - // doesn't have a load address, then it must be something that we were - // expecting to load (for instance we - // read a load command for it) but it didn't in fact load - probably because - // DYLD_*_PATH pointed - // to an equivalent version. We don't want it to stay in the target's - // module list or it will confuse - // us, so unload it here. + // images for our target that doesn't have a load address, then it must be + // something that we were expecting to load (for instance we read a load + // command for it) but it didn't in fact load - probably because + // DYLD_*_PATH pointed to an equivalent version. We don't want it to stay + // in the target's module list or it will confuse us, so unload it here. Target &target = m_process->GetTarget(); const ModuleList &target_modules = target.GetImages(); ModuleList not_loaded_modules; @@ -784,8 +770,8 @@ } //---------------------------------------------------------------------- -// Read a mach_header at ADDR into HEADER, and also fill in the load -// command data into LOAD_COMMAND_DATA if it is non-NULL. +// Read a mach_header at ADDR into HEADER, and also fill in the load command +// data into LOAD_COMMAND_DATA if it is non-NULL. // // Returns true if we succeed, false if we fail for any reason. //---------------------------------------------------------------------- @@ -840,8 +826,8 @@ load_cmd_data_sp->GetByteSize(), error); if (load_cmd_bytes_read == header->sizeofcmds) { - // Set the load command data and also set the correct endian - // swap settings and the correct address size + // Set the load command data and also set the correct endian swap + // settings and the correct address size load_command_data->SetData(load_cmd_data_sp, 0, header->sizeofcmds); load_command_data->SetByteOrder(data.GetByteOrder()); load_command_data->SetAddressByteSize(data.GetAddressByteSize()); @@ -867,8 +853,8 @@ dylib_info.Clear(true); for (cmd_idx = 0; cmd_idx < dylib_info.header.ncmds; cmd_idx++) { - // Clear out any load command specific data from DYLIB_INFO since - // we are about to read it. + // Clear out any load command specific data from DYLIB_INFO since we are + // about to read it. if (data.ValidOffsetForDataOfSize(offset, sizeof(llvm::MachO::load_command))) { @@ -880,8 +866,8 @@ case llvm::MachO::LC_SEGMENT: { segment.name.SetTrimmedCStringWithLength( (const char *)data.GetData(&offset, 16), 16); - // We are putting 4 uint32_t values 4 uint64_t values so - // we have to use multiple 32 bit gets below. + // We are putting 4 uint32_t values 4 uint64_t values so we have to use + // multiple 32 bit gets below. segment.vmaddr = data.GetU32(&offset); segment.vmsize = data.GetU32(&offset); segment.fileoff = data.GetU32(&offset); @@ -922,24 +908,21 @@ } } - // All sections listed in the dyld image info structure will all - // either be fixed up already, or they will all be off by a single - // slide amount that is determined by finding the first segment - // that is at file offset zero which also has bytes (a file size - // that is greater than zero) in the object file. + // All sections listed in the dyld image info structure will all either be + // fixed up already, or they will all be off by a single slide amount that is + // determined by finding the first segment that is at file offset zero which + // also has bytes (a file size that is greater than zero) in the object file. // Determine the slide amount (if any) const size_t num_sections = dylib_info.segments.size(); for (size_t i = 0; i < num_sections; ++i) { - // Iterate through the object file sections to find the - // first section that starts of file offset zero and that - // has bytes in the file... + // Iterate through the object file sections to find the first section that + // starts of file offset zero and that has bytes in the file... if ((dylib_info.segments[i].fileoff == 0 && dylib_info.segments[i].filesize > 0) || (dylib_info.segments[i].name == ConstString("__TEXT"))) { dylib_info.slide = dylib_info.address - dylib_info.segments[i].vmaddr; - // We have found the slide amount, so we can exit - // this for loop. + // We have found the slide amount, so we can exit this for loop. break; } } @@ -984,11 +967,11 @@ // Don't load dependent images since we are in dyld where we will know // and find out about all images that are loaded. Also when setting the // executable module, it will clear the targets module list, and if we - // have an in memory dyld module, it will get removed from the list - // so we will need to add it back after setting the executable module, - // so we first try and see if we already have a weak pointer to the - // dyld module, make it into a shared pointer, then add the executable, - // then re-add it back to make sure it is always in the list. + // have an in memory dyld module, it will get removed from the list so + // we will need to add it back after setting the executable module, so + // we first try and see if we already have a weak pointer to the dyld + // module, make it into a shared pointer, then add the executable, then + // re-add it back to make sure it is always in the list. ModuleSP dyld_module_sp(GetDYLDModule()); const bool get_dependent_images = false; @@ -1009,8 +992,8 @@ } //---------------------------------------------------------------------- -// Dump the _dyld_all_image_infos members and all current image infos -// that we have parsed to the file handle provided. +// Dump the _dyld_all_image_infos members and all current image infos that we +// have parsed to the file handle provided. //---------------------------------------------------------------------- void DynamicLoaderMacOSXDYLD::PutToLog(Log *log) const { if (log == NULL) @@ -1039,10 +1022,9 @@ if (m_break_id == LLDB_INVALID_BREAK_ID) { if (m_dyld_all_image_infos.notification != LLDB_INVALID_ADDRESS) { Address so_addr; - // Set the notification breakpoint and install a breakpoint - // callback function that will get called each time the - // breakpoint gets hit. We will use this to track when shared - // libraries get loaded/unloaded. + // Set the notification breakpoint and install a breakpoint callback + // function that will get called each time the breakpoint gets hit. We + // will use this to track when shared libraries get loaded/unloaded. bool resolved = m_process->GetTarget().ResolveLoadAddress( m_dyld_all_image_infos.notification, so_addr); if (!resolved) { @@ -1071,9 +1053,9 @@ Status DynamicLoaderMacOSXDYLD::CanLoadImage() { Status error; - // In order for us to tell if we can load a shared library we verify that - // the dylib_info_addr isn't zero (which means no shared libraries have - // been set yet, or dyld is currently mucking with the shared library list). + // In order for us to tell if we can load a shared library we verify that the + // dylib_info_addr isn't zero (which means no shared libraries have been set + // yet, or dyld is currently mucking with the shared library list). if (ReadAllImageInfosStructure()) { // TODO: also check the _dyld_global_lock_held variable in // libSystem.B.dylib? @@ -1099,13 +1081,10 @@ addr_t all_image_infos = m_process->GetImageInfoAddress(); // The address returned by GetImageInfoAddress may be the address of dyld - // (don't want) - // or it may be the address of the dyld_all_image_infos structure (want). - // The first four - // bytes will be either the version field (all_image_infos) or a Mach-O file - // magic constant. - // Version 13 and higher of dyld_all_image_infos is required to get the - // sharedCacheUUID field. + // (don't want) or it may be the address of the dyld_all_image_infos + // structure (want). The first four bytes will be either the version field + // (all_image_infos) or a Mach-O file magic constant. Version 13 and higher + // of dyld_all_image_infos is required to get the sharedCacheUUID field. Status err; uint32_t version_or_magic = Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp @@ -45,8 +45,8 @@ if (log) log->Printf("%s info_location = 0x%" PRIx64, __FUNCTION__, info_location); - // If the process fails to return an address, fall back to seeing if the local - // object file can help us find it. + // If the process fails to return an address, fall back to seeing if the + // local object file can help us find it. if (info_location == LLDB_INVALID_ADDRESS) { Target *target = &process->GetTarget(); if (target) { @@ -190,8 +190,8 @@ if (!fromRemote && m_current.map_addr == 0) return false; - // When the previous and current states are consistent this is the first - // time we have been asked to update. Just take a snapshot of the currently + // When the previous and current states are consistent this is the first time + // we have been asked to update. Just take a snapshot of the currently // loaded modules. if (m_previous.state == eConsistent && m_current.state == eConsistent) return fromRemote ? SaveSOEntriesFromRemote(module_list) @@ -200,9 +200,9 @@ // If we are about to add or remove a shared object clear out the current // state and take a snapshot of the currently loaded images. if (m_current.state == eAdd || m_current.state == eDelete) { - // Some versions of the android dynamic linker might send two - // notifications with state == eAdd back to back. Ignore them - // until we get an eConsistent notification. + // Some versions of the android dynamic linker might send two notifications + // with state == eAdd back to back. Ignore them until we get an eConsistent + // notification. if (!(m_previous.state == eConsistent || (m_previous.state == eAdd && m_current.state == eDelete))) return false; @@ -449,13 +449,11 @@ } // Returns true if the load bias reported by the linker is incorrect for the -// given entry. This -// function is used to handle cases where we want to work around a bug in the -// system linker. +// given entry. This function is used to handle cases where we want to work +// around a bug in the system linker. static bool isLoadBiasIncorrect(Target &target, const std::string &file_path) { // On Android L (API 21, 22) the load address of the "/system/bin/linker" - // isn't filled in - // correctly. + // isn't filled in correctly. uint32_t os_major = 0, os_minor = 0, os_update = 0; if (target.GetArchitecture().GetTriple().isAndroid() && target.GetPlatform()->GetOSVersion(os_major, os_minor, os_update) && @@ -471,8 +469,7 @@ void DYLDRendezvous::UpdateBaseAddrIfNecessary(SOEntry &entry, std::string const &file_path) { // If the load bias reported by the linker is incorrect then fetch the load - // address of the file - // from the proc file system. + // address of the file from the proc file system. if (isLoadBiasIncorrect(m_process->GetTarget(), file_path)) { lldb::addr_t load_addr = LLDB_INVALID_ADDRESS; bool is_loaded = false; @@ -491,8 +488,8 @@ if (!(addr = ReadPointer(addr, &entry.base_addr))) return false; - // mips adds an extra load offset field to the link map struct on - // FreeBSD and NetBSD (need to validate other OSes). + // mips adds an extra load offset field to the link map struct on FreeBSD and + // NetBSD (need to validate other OSes). // http://svnweb.freebsd.org/base/head/sys/sys/link_elf.h?revision=217153&view=markup#l57 const ArchSpec &arch = m_process->GetTarget().GetArchitecture(); if ((arch.GetTriple().getOS() == llvm::Triple::FreeBSD || Index: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -155,8 +155,8 @@ LoadAllCurrentModules(); if (!SetRendezvousBreakpoint()) { - // If we cannot establish rendezvous breakpoint right now - // we'll try again at entry point. + // If we cannot establish rendezvous breakpoint right now we'll try again + // at entry point. ProbeEntry(); } @@ -199,8 +199,8 @@ __FUNCTION__); if (!SetRendezvousBreakpoint()) { - // If we cannot establish rendezvous breakpoint right now - // we'll try again at entry point. + // If we cannot establish rendezvous breakpoint right now we'll try again + // at entry point. ProbeEntry(); } @@ -259,11 +259,11 @@ } // The runtime linker has run and initialized the rendezvous structure once the -// process has hit its entry point. When we hit the corresponding breakpoint we -// interrogate the rendezvous structure to get the load addresses of all +// process has hit its entry point. When we hit the corresponding breakpoint +// we interrogate the rendezvous structure to get the load addresses of all // dependent modules for the process. Similarly, we can discover the runtime -// linker function and setup a breakpoint to notify us of any dynamically loaded -// modules (via dlopen). +// linker function and setup a breakpoint to notify us of any dynamically +// loaded modules (via dlopen). bool DynamicLoaderPOSIXDYLD::EntryBreakpointHit( void *baton, StoppointCallbackContext *context, user_id_t break_id, user_id_t break_loc_id) { @@ -281,13 +281,11 @@ : LLDB_INVALID_PROCESS_ID); // Disable the breakpoint --- if a stop happens right after this, which we've - // seen on occasion, we don't - // want the breakpoint stepping thread-plan logic to show a breakpoint - // instruction at the disassembled - // entry point to the program. Disabling it prevents it. (One-shot is not - // enough - one-shot removal logic - // only happens after the breakpoint goes public, which wasn't happening in - // our scenario). + // seen on occasion, we don't want the breakpoint stepping thread-plan logic + // to show a breakpoint instruction at the disassembled entry point to the + // program. Disabling it prevents it. (One-shot is not enough - one-shot + // removal logic only happens after the breakpoint goes public, which wasn't + // happening in our scenario). if (dyld_instance->m_process) { BreakpointSP breakpoint_sp = dyld_instance->m_process->GetTarget().GetBreakpointByID(break_id); @@ -345,8 +343,8 @@ return false; } - // Function names from different dynamic loaders that are known - // to be used as rendezvous between the loader and debuggers. + // Function names from different dynamic loaders that are known to be used + // as rendezvous between the loader and debuggers. static std::vector DebugStateCandidates{ "_dl_debug_state", "rtld_db_dlactivity", "__dl_rtld_db_dlactivity", "r_debug_state", "_r_debug_state", "_rtld_debug_state", @@ -572,8 +570,8 @@ return; } - // The rendezvous class doesn't enumerate the main module, so track - // that ourselves here. + // The rendezvous class doesn't enumerate the main module, so track that + // ourselves here. ModuleSP executable = GetTargetExecutable(); m_loaded_modules[executable] = m_rendezvous.GetLinkMapAddress(); Index: lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp =================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp +++ lldb/trunk/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp @@ -19,9 +19,9 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Create an instance of this class. This function is filled into -// the plugin info class that gets handed out by the plugin factory and -// allows the lldb to instantiate an instance of this class. +// Create an instance of this class. This function is filled into the plugin +// info class that gets handed out by the plugin factory and allows the lldb to +// instantiate an instance of this class. //---------------------------------------------------------------------- DynamicLoader *DynamicLoaderStatic::CreateInstance(Process *process, bool force) { @@ -97,17 +97,17 @@ if (section_list) { // All sections listed in the dyld image info structure will all // either be fixed up already, or they will all be off by a single - // slide amount that is determined by finding the first segment - // that is at file offset zero which also has bytes (a file size - // that is greater than zero) in the object file. + // slide amount that is determined by finding the first segment that + // is at file offset zero which also has bytes (a file size that is + // greater than zero) in the object file. // Determine the slide amount (if any) const size_t num_sections = section_list->GetSize(); size_t sect_idx = 0; for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) { - // Iterate through the object file sections to find the - // first section that starts of file offset zero and that - // has bytes in the file... + // Iterate through the object file sections to find the first + // section that starts of file offset zero and that has bytes in + // the file... SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp) { if (m_process->GetTarget().SetSectionLoadAddress( Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp @@ -226,8 +226,7 @@ return true; // In C++11, last_expr can be a LValueToRvalue implicit cast. Strip that off - // if that's the - // case. + // if that's the case. do { ImplicitCastExpr *implicit_cast = dyn_cast(last_expr); @@ -242,8 +241,8 @@ } while (0); // is_lvalue is used to record whether the expression returns an assignable - // Lvalue or an - // Rvalue. This is relevant because they are handled differently. + // Lvalue or an Rvalue. This is relevant because they are handled + // differently. // // For Lvalues // Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -33,8 +33,8 @@ using namespace lldb_private; //------------------------------------------------------------------ -// Scoped class that will remove an active lexical decl from the set -// when it goes out of scope. +// Scoped class that will remove an active lexical decl from the set when it +// goes out of scope. //------------------------------------------------------------------ namespace { class ScopedLexicalDeclEraser { @@ -141,8 +141,8 @@ m_ast_importer_sp->ForgetDestination(m_ast_context); // We are in the process of destruction, don't create clang ast context on - // demand - // by passing false to Target::GetScratchClangASTContext(create_on_demand). + // demand by passing false to + // Target::GetScratchClangASTContext(create_on_demand). ClangASTContext *scratch_clang_ast_context = m_target->GetScratchClangASTContext(false); @@ -231,8 +231,8 @@ } if (!GetLookupsEnabled()) { - // Wait until we see a '$' at the start of a name before we start doing - // any lookups so we can avoid lookup up all of the builtin types. + // Wait until we see a '$' at the start of a name before we start doing any + // lookups so we can avoid lookup up all of the builtin types. if (!decl_name.empty() && decl_name[0] == '$') { SetLookupsEnabled(true); } else { @@ -297,8 +297,8 @@ } if (!m_ast_importer_sp->CompleteTagDecl(tag_decl)) { - // We couldn't complete the type. Maybe there's a definition - // somewhere else that can be completed. + // 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 " @@ -398,8 +398,8 @@ const_cast(tag_type->getDecl()); // We have found a type by basename and we need to make sure the decl - // contexts - // are the same before we can try to complete this type with another + // contexts are the same before we can try to complete this type with + // another if (!ClangASTContext::DeclsAreEquivalent(tag_decl, candidate_tag_decl)) continue; @@ -1243,8 +1243,8 @@ 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. + // way, we need to check that they're actually in categories on the desired + // class. SymbolContextList candidate_sc_list; @@ -1591,8 +1591,7 @@ do { // Check the runtime only if the debug information didn't have a complete - // interface - // and nothing was in the modules. + // interface and nothing was in the modules. lldb::ProcessSP process(m_target->GetProcessSP()); @@ -1645,12 +1644,9 @@ ClangASTSource &source) { // When importing fields into a new record, clang has a hard requirement that // fields be imported in field offset order. Since they are stored in a - // DenseMap - // with a pointer as the key type, this means we cannot simply iterate over - // the - // map, as the order will be non-deterministic. Instead we have to sort by - // the offset - // and then insert in sorted order. + // DenseMap with a pointer as the key type, this means we cannot simply + // iterate over the map, as the order will be non-deterministic. Instead we + // have to sort by the offset and then insert in sorted order. typedef llvm::DenseMap MapType; typedef typename MapType::value_type PairType; std::vector sorted_items; @@ -2051,9 +2047,8 @@ if (copied_qual_type.getAsOpaquePtr() && copied_qual_type->getCanonicalTypeInternal().isNull()) - // this shouldn't happen, but we're hardening because the AST importer seems - // to be generating bad types - // on occasion. + // this shouldn't happen, but we're hardening because the AST importer + // seems to be generating bad types on occasion. return CompilerType(); return CompilerType(m_ast_context, copied_qual_type); @@ -2156,8 +2151,8 @@ log->Printf("Function type wasn't a FunctionProtoType"); } - // If this is an operator (e.g. operator new or operator==), only insert - // the declaration we inferred from the symbol if we can provide the correct + // If this is an operator (e.g. operator new or operator==), only insert the + // declaration we inferred from the symbol if we can provide the correct // number of arguments. We shouldn't really inject random decl(s) for // functions that are analyzed semantically in a special way, otherwise we // will crash in clang. Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -213,8 +213,8 @@ m_exporter.getFromContext().getSourceManager().getFileID(loc); if (file != m_file) return false; - // We are assuming the Decl was parsed in this very expression, so it should - // not have external storage. + // We are assuming the Decl was parsed in this very expression, so it + // should not have external storage. lldbassert(!llvm::cast(decl)->hasExternalLexicalStorage()); return true; } @@ -591,8 +591,8 @@ if (!entity) return false; - // We know m_parser_vars is valid since we searched for the variable by - // its NamedDecl + // We know m_parser_vars is valid since we searched for the variable by its + // NamedDecl ClangExpressionVariable::ParserVars *parser_vars = entity->GetParserVars(GetParserID()); @@ -867,8 +867,8 @@ if (IgnoreName(name, false)) return; - // Only look for functions by name out in our symbols if the function - // doesn't start with our phony prefix of '$' + // Only look for functions by name out in our symbols if the function doesn't + // start with our phony prefix of '$' Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); SymbolContext sym_ctx; @@ -977,13 +977,11 @@ m_struct_vars->m_object_pointer_type = self_user_type; } } else { - // This branch will get hit if we are executing code in the context of a - // function that - // claims to have an object pointer (through DW_AT_object_pointer?) but - // is not formally a - // method of the class. In that case, just look up the "this" variable - // in the current - // scope and use its type. + // This branch will get hit if we are executing code in the context of + // a function that claims to have an object pointer (through + // DW_AT_object_pointer?) but is not formally a method of the class. + // In that case, just look up the "this" variable in the current scope + // and use its type. // FIXME: This code is formally correct, but clang doesn't currently // emit DW_AT_object_pointer // for C++ so it hasn't actually been tested. @@ -1093,13 +1091,11 @@ return; } else { - // This branch will get hit if we are executing code in the context of a - // function that - // claims to have an object pointer (through DW_AT_object_pointer?) but - // is not formally a - // method of the class. In that case, just look up the "self" variable - // in the current - // scope and use its type. + // This branch will get hit if we are executing code in the context of + // a function that claims to have an object pointer (through + // DW_AT_object_pointer?) but is not formally a method of the class. + // In that case, just look up the "self" variable in the current scope + // and use its type. VariableList *vars = frame->GetVariableList(false); @@ -1217,9 +1213,8 @@ vars->GetVariableAtIndex(i)->GetDecl(); // Search for declarations matching the name. Do not include imported - // decls - // in the search if we are looking for decls in the artificial namespace - // $__lldb_local_vars. + // decls in the search if we are looking for decls in the artificial + // namespace $__lldb_local_vars. std::vector found_decls = compiler_decl_context.FindDeclByName(name, namespace_decl.IsValid()); @@ -1285,15 +1280,15 @@ append, sc_list); } - // If we found more than one function, see if we can use the - // frame's decl context to remove functions that are shadowed - // by other functions which match in type but are nearer in scope. + // If we found more than one function, see if we can use the frame's decl + // context to remove functions that are shadowed by other functions which + // match in type but are nearer in scope. // // AddOneFunction will not add a function whose type has already been - // added, so if there's another function in the list with a matching - // type, check to see if their decl context is a parent of the current - // frame's or was imported via a and using statement, and pick the - // best match according to lookup rules. + // added, so if there's another function in the list with a matching type, + // check to see if their decl context is a parent of the current frame's or + // was imported via a and using statement, and pick the best match + // according to lookup rules. if (sc_list.GetSize() > 1) { // Collect some info about our frame's context. StackFrame *frame = m_parser_vars->m_exe_ctx.GetFramePtr(); @@ -1321,11 +1316,10 @@ SymbolContext m_sym_ctx; }; - // First, symplify things by looping through the symbol contexts - // to remove unwanted functions and separate out the functions we - // want to compare and prune into a separate list. - // Cache the info needed about the function declarations in a - // vector for efficiency. + // First, symplify things by looping through the symbol contexts to + // remove unwanted functions and separate out the functions we want to + // compare and prune into a separate list. Cache the info needed about + // the function declarations in a vector for efficiency. SymbolContextList sc_sym_list; uint32_t num_indices = sc_list.GetSize(); std::vector fdi_cache; @@ -1335,16 +1329,16 @@ SymbolContext sym_ctx; sc_list.GetContextAtIndex(index, sym_ctx); - // We don't know enough about symbols to compare them, - // but we should keep them in the list. + // We don't know enough about symbols to compare them, but we should + // keep them in the list. Function *function = sym_ctx.function; if (!function) { sc_sym_list.Append(sym_ctx); continue; } // Filter out functions without declaration contexts, as well as - // class/instance methods, since they'll be skipped in the - // code that follows anyway. + // class/instance methods, since they'll be skipped in the code that + // follows anyway. CompilerDeclContext func_decl_context = function->GetDeclContext(); if (!func_decl_context || func_decl_context.IsClassMethod(nullptr, nullptr, nullptr)) @@ -1363,11 +1357,10 @@ fdi.m_copied_type = copied_func_type; fdi.m_decl_lvl = LLDB_INVALID_DECL_LEVEL; if (fdi.m_copied_type && func_decl_context) { - // Call CountDeclLevels to get the number of parent scopes we - // have to look through before we find the function declaration. - // When comparing functions of the same type, the one with a - // lower count will be closer to us in the lookup scope and - // shadows the other. + // Call CountDeclLevels to get the number of parent scopes we have + // to look through before we find the function declaration. When + // comparing functions of the same type, the one with a lower count + // will be closer to us in the lookup scope and shadows the other. clang::DeclContext *func_decl_ctx = (clang::DeclContext *)func_decl_context.GetOpaqueDeclContext(); fdi.m_decl_lvl = ast->CountDeclLevels( @@ -1536,9 +1529,8 @@ } if (target && !context.m_found.variable && !namespace_decl) { - // We couldn't find a non-symbol variable for this. Now we'll hunt for - // a generic - // data symbol, and -- if it is found -- treat it as a variable. + // We couldn't find a non-symbol variable for this. Now we'll hunt for a + // generic data symbol, and -- if it is found -- treat it as a variable. Status error; const Symbol *data_symbol = Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -182,8 +182,7 @@ m_manager->AddDiagnostic(new_diagnostic); // Don't store away warning fixits, since the compiler doesn't have - // enough - // context in an expression for the warning to be useful. + // enough context in an expression for the warning to be useful. // FIXME: Should we try to filter out FixIts that apply to our generated // code, and not the user's expression? if (severity == eDiagnosticSeverityError) { @@ -226,10 +225,9 @@ m_code_generator(), m_pp_callbacks(nullptr) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - // We can't compile expressions without a target. So if the exe_scope is null - // or doesn't have a target, - // then we just need to get out of here. I'll lldb_assert and not make any of - // the compiler objects since + // We can't compile expressions without a target. So if the exe_scope is + // null or doesn't have a target, then we just need to get out of here. I'll + // lldb_assert and not make any of the compiler objects since // I can't return errors directly from the constructor. Further calls will // check if the compiler was made and // bag out if it wasn't. @@ -262,14 +260,14 @@ const auto target_machine = target_arch.GetMachine(); - // If the expression is being evaluated in the context of an existing - // stack frame, we introspect to see if the language runtime is available. + // If the expression is being evaluated in the context of an existing stack + // frame, we introspect to see if the language runtime is available. lldb::StackFrameSP frame_sp = exe_scope->CalculateStackFrame(); lldb::ProcessSP process_sp = exe_scope->CalculateProcess(); - // Make sure the user hasn't provided a preferred execution language - // with `expression --language X -- ...` + // Make sure the user hasn't provided a preferred execution language with + // `expression --language X -- ...` if (frame_sp && frame_lang == lldb::eLanguageTypeUnknown) frame_lang = frame_sp->GetLanguage(); @@ -281,8 +279,7 @@ } // 2. Configure the compiler with a set of default options that are - // appropriate - // for most situations. + // appropriate for most situations. if (target_arch.IsValid()) { std::string triple = target_arch.GetTriple().str(); m_compiler->getTargetOpts().Triple = triple; @@ -292,19 +289,17 @@ } else { // If we get here we don't have a valid target and just have to guess. // Sometimes this will be ok to just use the host target triple (when we - // evaluate say "2+3", but other - // expressions like breakpoint conditions and other things that _are_ target - // specific really shouldn't just be - // using the host triple. In such a case the language runtime should expose - // an overridden options set (3), - // below. + // evaluate say "2+3", but other expressions like breakpoint conditions and + // other things that _are_ target specific really shouldn't just be using + // the host triple. In such a case the language runtime should expose an + // overridden options set (3), below. m_compiler->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); if (log) log->Printf("Using default target triple of %s", m_compiler->getTargetOpts().Triple.c_str()); } - // Now add some special fixes for known architectures: - // Any arm32 iOS environment, but not on arm64 + // Now add some special fixes for known architectures: Any arm32 iOS + // environment, but not on arm64 if (m_compiler->getTargetOpts().Triple.find("arm64") == std::string::npos && m_compiler->getTargetOpts().Triple.find("arm") != std::string::npos && m_compiler->getTargetOpts().Triple.find("ios") != std::string::npos) { @@ -317,8 +312,8 @@ m_compiler->getTargetOpts().Features.push_back("+sse2"); } - // Set the target CPU to generate code for. - // This will be empty for any CPU that doesn't really need to make a special + // Set the target CPU to generate code for. This will be empty for any CPU + // that doesn't really need to make a special // CPU string. m_compiler->getTargetOpts().CPU = target_arch.GetClangTargetCPU(); @@ -328,11 +323,9 @@ m_compiler->getTargetOpts().ABI = abi; // 3. Now allow the runtime to provide custom configuration options for the - // target. - // In this case, a specialized language runtime is available and we can query - // it for extra options. - // For 99% of use cases, this will not be needed and should be provided when - // basic platform detection is not enough. + // target. In this case, a specialized language runtime is available and we + // can query it for extra options. For 99% of use cases, this will not be + // needed and should be provided when basic platform detection is not enough. if (lang_rt) overridden_target_opts = lang_rt->GetOverrideExprOptions(m_compiler->getTargetOpts()); @@ -378,9 +371,9 @@ case lldb::eLanguageTypeC11: // FIXME: the following language option is a temporary workaround, // to "ask for C, get C++." - // For now, the expression parser must use C++ anytime the - // language is a C family language, because the expression parser - // uses features of C++ to capture values. + // For now, the expression parser must use C++ anytime the language is a C + // family language, because the expression parser uses features of C++ to + // capture values. m_compiler->getLangOpts().CPlusPlus = true; break; case lldb::eLanguageTypeObjC: @@ -392,10 +385,10 @@ // Clang now sets as default C++14 as the default standard (with // GNU extensions), so we do the same here to avoid mismatches that - // cause compiler error when evaluating expressions (e.g. nullptr - // not found as it's a C++11 feature). Currently lldb evaluates - // C++14 as C++11 (see two lines below) so we decide to be consistent - // with that, but this could be re-evaluated in the future. + // cause compiler error when evaluating expressions (e.g. nullptr not found + // as it's a C++11 feature). Currently lldb evaluates C++14 as C++11 (see + // two lines below) so we decide to be consistent with that, but this could + // be re-evaluated in the future. m_compiler->getLangOpts().CPlusPlus11 = true; break; case lldb::eLanguageTypeC_plus_plus: @@ -407,8 +400,8 @@ case lldb::eLanguageTypeC_plus_plus_03: m_compiler->getLangOpts().CPlusPlus = true; // FIXME: the following language option is a temporary workaround, - // to "ask for C++, get ObjC++". Apple hopes to remove this requirement - // on non-Apple platforms, but for now it is needed. + // to "ask for C++, get ObjC++". Apple hopes to remove this requirement on + // non-Apple platforms, but for now it is needed. m_compiler->getLangOpts().ObjC1 = true; break; case lldb::eLanguageTypeObjC_plus_plus: @@ -434,10 +427,9 @@ ArchSpec(m_compiler->getTargetOpts().Triple.c_str()) .CharIsSignedByDefault(); - // Spell checking is a nice feature, but it ends up completing a - // lot of types that we didn't strictly speaking need to complete. - // As a result, we spend a long time parsing and importing debug - // information. + // Spell checking is a nice feature, but it ends up completing a lot of types + // that we didn't strictly speaking need to complete. As a result, we spend a + // long time parsing and importing debug information. m_compiler->getLangOpts().SpellChecking = false; if (process_sp && m_compiler->getLangOpts().ObjC1) { @@ -513,8 +505,8 @@ m_compiler->getPreprocessor().addPPCallbacks(std::move(pp_callbacks)); } - // 8. Most of this we get from the CompilerInstance, but we - // also want to give the context an ExternalASTSource. + // 8. Most of this we get from the CompilerInstance, but we also want to give + // the context an ExternalASTSource. m_selector_table.reset(new SelectorTable()); m_builtin_context.reset(new Builtin::Context()); Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp @@ -101,14 +101,12 @@ m_wrapper_function_text.append(" (*fn_ptr) ("); // Get the number of arguments. If we have a function type and it is - // prototyped, - // trust that, otherwise use the values we were given. + // prototyped, trust that, otherwise use the values we were given. // FIXME: This will need to be extended to handle Variadic functions. We'll // need // to pull the defined arguments out of the function, then add the types from - // the - // arguments list for the variable arguments. + // the arguments list for the variable arguments. uint32_t num_args = UINT32_MAX; bool trust_function = false; Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -40,9 +40,9 @@ using namespace lldb_private; namespace { -// Any Clang compiler requires a consumer for diagnostics. This one stores them -// as strings -// so we can provide them to the user in case a module failed to load. +// Any Clang compiler requires a consumer for diagnostics. This one stores +// them as strings so we can provide them to the user in case a module failed +// to load. class StoringDiagnosticConsumer : public clang::DiagnosticConsumer { public: StoringDiagnosticConsumer(); @@ -62,8 +62,7 @@ }; // The private implementation of our ClangModulesDeclVendor. Contains all the -// Clang state required -// to load modules. +// Clang state required to load modules. class ClangModulesDeclVendorImpl : public ClangModulesDeclVendor { public: ClangModulesDeclVendorImpl( Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -195,12 +195,10 @@ } else if (clang::FunctionDecl *function_decl = ClangASTContext::DeclContextGetAsFunctionDecl(decl_context)) { // We might also have a function that said in the debug information that it - // captured an - // object pointer. The best way to deal with getting to the ivars at - // present is by pretending - // that this is a method of a class in whatever runtime the debug info says - // the object pointer - // belongs to. Do that here. + // captured an object pointer. The best way to deal with getting to the + // ivars at present is by pretending that this is a method of a class in + // whatever runtime the debug info says the object pointer belongs to. Do + // that here. ClangASTMetadata *metadata = ClangASTContext::DeclContextGetMetaData(decl_context, function_decl); @@ -290,10 +288,10 @@ } } -// This is a really nasty hack, meant to fix Objective-C expressions of the form -// (int)[myArray count]. Right now, because the type information for count is -// not available, [myArray count] returns id, which can't be directly cast to -// int without causing a clang error. +// This is a really nasty hack, meant to fix Objective-C expressions of the +// form (int)[myArray count]. Right now, because the type information for +// count is not available, [myArray count] returns id, which can't be directly +// cast to int without causing a clang error. static void ApplyObjcCastHack(std::string &expr) { #define OBJC_CAST_HACK_FROM "(int)[" #define OBJC_CAST_HACK_TO "(int)(long long)[" @@ -463,17 +461,15 @@ exe_scope = exe_ctx.GetTargetPtr(); // We use a shared pointer here so we can use the original parser - if it - // succeeds - // or the rewrite parser we might make if it fails. But the parser_sp will - // never be empty. + // succeeds or the rewrite parser we might make if it fails. But the + // parser_sp will never be empty. ClangExpressionParser parser(exe_scope, *this, generate_debug_info); unsigned num_errors = parser.Parse(diagnostic_manager); // Check here for FixItHints. If there are any try to apply the fixits and - // set the fixed text in m_fixed_text - // before returning an error. + // set the fixed text in m_fixed_text before returning an error. if (num_errors) { if (diagnostic_manager.HasFixIts()) { if (parser.RewriteExpression(diagnostic_manager)) { @@ -495,8 +491,8 @@ } ////////////////////////////////////////////////////////////////////////////////////////// - // Prepare the output of the parser for execution, evaluating it statically if - // possible + // Prepare the output of the parser for execution, evaluating it statically + // if possible // { @@ -539,9 +535,9 @@ register_execution_unit = true; } - // If there is more than one external function in the execution - // unit, it needs to keep living even if it's not top level, because - // the result could refer to that function. + // If there is more than one external function in the execution unit, it + // needs to keep living even if it's not top level, because the result + // could refer to that function. if (m_execution_unit_sp->GetJittedFunctions().size() > 1) { register_execution_unit = true; Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -263,8 +263,7 @@ } // Get the next available result name from m_decl_map and create the - // persistent - // variable for it + // persistent variable for it // If the result is an Lvalue, it is emitted as a pointer; see // ASTResultSynthesizer::SynthesizeBodyResult. @@ -345,9 +344,9 @@ GlobalValue::ExternalLinkage, NULL, /* no initializer */ m_result_name.GetCString()); - // It's too late in compilation to create a new VarDecl for this, but we don't - // need to. We point the metadata at the old VarDecl. This creates an odd - // anomaly: a variable with a Value whose name is something like $0 and a + // It's too late in compilation to create a new VarDecl for this, but we + // don't need to. We point the metadata at the old VarDecl. This creates an + // odd anomaly: a variable with a Value whose name is something like $0 and a // Decl whose name is $__lldb_expr_result. This condition is handled in // ClangExpressionDeclMap::DoMaterialize, and the name of the variable is // fixed up. @@ -464,9 +463,7 @@ // CFAllocatorRef -> i8* // UInt8 * -> i8* // CFIndex -> long (i32 or i64, as appropriate; we ask the module for its - // pointer size for now) - // CFStringEncoding -> i32 - // Boolean -> i8 + // pointer size for now) CFStringEncoding -> i32 Boolean -> i8 Type *arg_type_array[5]; @@ -801,9 +798,8 @@ // Unpack the message name from the selector. In LLVM IR, an objc_msgSend // gets represented as // - // %tmp = load i8** @"OBJC_SELECTOR_REFERENCES_" ; - // %call = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %obj, i8* %tmp, ...) - // ; + // %tmp = load i8** @"OBJC_SELECTOR_REFERENCES_" ; %call = call + // i8* (i8*, i8*, ...)* @objc_msgSend(i8* %obj, i8* %tmp, ...) ; // // where %obj is the object pointer and %tmp is the selector. // @@ -870,7 +866,8 @@ log->Printf("Found sel_registerName at 0x%" PRIx64, sel_registerName_addr); - // Build the function type: struct objc_selector *sel_registerName(uint8_t*) + // Build the function type: struct objc_selector + // *sel_registerName(uint8_t*) // The below code would be "more correct," but in actuality what's required // is uint8_t* @@ -980,11 +977,10 @@ // %struct._objc_class** @OBJC_CLASS_REFERENCES_, align 4 // // @"OBJC_CLASS_REFERENCES_ is a bitcast of a character array called - // @OBJC_CLASS_NAME_. - // @OBJC_CLASS_NAME contains the string. + // @OBJC_CLASS_NAME_. @OBJC_CLASS_NAME contains the string. - // Find the pointer's initializer (a ConstantExpr with opcode BitCast) - // and get the string from its target + // Find the pointer's initializer (a ConstantExpr with opcode BitCast) and + // get the string from its target GlobalVariable *_objc_class_references_ = dyn_cast(load->getPointerOperand()); @@ -1159,8 +1155,8 @@ GlobalValue::ExternalLinkage, NULL, /* no initializer */ alloc->getName().str()); - // What we're going to do here is make believe this was a regular old external - // variable. That means we need to make the metadata valid. + // What we're going to do here is make believe this was a regular old + // external variable. That means we need to make the metadata valid. NamedMDNode *named_metadata = m_module->getOrInsertNamedMetadata("clang.global.decl.ptrs"); @@ -1175,8 +1171,7 @@ named_metadata->addOperand(persistent_global_md); // Now, since the variable is a pointer variable, we will drop in a load of - // that - // pointer variable. + // that pointer variable. LoadInst *persistent_load = new LoadInst(persistent_global, "", alloc); @@ -1366,16 +1361,13 @@ if (name[0] == '$') { // The $__lldb_expr_result name indicates the return value has allocated - // as - // a static variable. Per the comment at - // ASTResultSynthesizer::SynthesizeBodyResult, - // accesses to this static variable need to be redirected to the result of - // dereferencing - // a pointer that is passed in as one of the arguments. + // as a static variable. Per the comment at + // ASTResultSynthesizer::SynthesizeBodyResult, accesses to this static + // variable need to be redirected to the result of dereferencing a + // pointer that is passed in as one of the arguments. // // Consequently, when reporting the size of the type, we report a pointer - // type pointing - // to the type of $__lldb_expr_result, not the type itself. + // type pointing to the type of $__lldb_expr_result, not the type itself. // // We also do this for any user-declared persistent variables. compiler_type = compiler_type.GetPointerType(); @@ -1965,12 +1957,11 @@ FunctionValueCache body_result_maker( [this, name, offset_type, offset, argument, value](llvm::Function *function) -> llvm::Value * { - // Per the comment at ASTResultSynthesizer::SynthesizeBodyResult, in - // cases where the result - // variable is an rvalue, we have to synthesize a dereference of the - // appropriate structure - // entry in order to produce the static variable that the AST thinks - // it is accessing. + // Per the comment at ASTResultSynthesizer::SynthesizeBodyResult, + // in cases where the result variable is an rvalue, we have to + // synthesize a dereference of the appropriate structure entry in + // order to produce the static variable that the AST thinks it is + // accessing. llvm::Instruction *entry_instruction = llvm::cast( m_entry_instruction_finder.GetValue(function)); @@ -2194,7 +2185,8 @@ if (log) log->Printf("RewriteObjCSelectors() failed"); - // RewriteObjCSelectors() reports its own errors, so we don't do so here + // RewriteObjCSelectors() reports its own errors, so we don't do so + // here return false; } Index: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -400,8 +400,7 @@ val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic); else { // When a variable is on the heap instead of the stack, go records a - // variable - // '&x' instead of 'x'. + // variable '&x' instead of 'x'. var_sp = var_list_sp->FindVariable(ConstString("&" + varname)); if (var_sp) { val = m_frame->GetValueObjectForFrameVariable(var_sp, m_use_dynamic); Index: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp =================================================================== --- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp +++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp @@ -258,8 +258,8 @@ reg_info.name = "f7"; break; - // Intel wireless MMX general purpose registers 0 - 7 - // XScale accumulator register 0 - 7 (they do overlap with wCGR0 - wCGR7) + // Intel wireless MMX general purpose registers 0 - 7 XScale accumulator + // register 0 - 7 (they do overlap with wCGR0 - wCGR7) case dwarf_wCGR0: reg_info.name = "wCGR0/ACC0"; break; @@ -901,7 +901,8 @@ } // Push Multiple Registers stores multiple registers to the stack, storing to -// consecutive memory locations ending just below the address in SP, and updates +// consecutive memory locations ending just below the address in SP, and +// updates // SP to point to the start of the stored data. bool EmulateInstructionARM::EmulatePUSH(const uint32_t opcode, const ARMEncoding encoding) { @@ -1390,8 +1391,8 @@ uint32_t imm32; // the immediate value to be written to Rd uint32_t carry = 0; // the carry bit after ThumbExpandImm_C or ARMExpandImm_C. - // for setflags == false, this value is a don't care - // initialized to 0 to silence the static analyzer + // for setflags == false, this value is a don't care initialized to + // 0 to silence the static analyzer bool setflags; switch (encoding) { case eEncodingT1: @@ -1473,12 +1474,11 @@ // MUL multiplies two register values. The least significant 32 bits of the // result are written to the destination // register. These 32 bits do not depend on whether the source register values -// are considered to be signed values or -// unsigned values. +// are considered to be signed values or unsigned values. // // Optionally, it can update the condition flags based on the result. In the -// Thumb instruction set, this option is -// limited to only a few forms of the instruction. +// Thumb instruction set, this option is limited to only a few forms of the +// instruction. bool EmulateInstructionARM::EmulateMUL(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -1606,8 +1606,8 @@ } // Bitwise NOT (immediate) writes the bitwise inverse of an immediate value to -// the destination register. -// It can optionally update the condition flags based on the value. +// the destination register. It can optionally update the condition flags based +// on the value. bool EmulateInstructionARM::EmulateMVNImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -1666,8 +1666,8 @@ } // Bitwise NOT (register) writes the bitwise inverse of a register value to the -// destination register. -// It can optionally update the condition flags based on the result. +// destination register. It can optionally update the condition flags based on +// the result. bool EmulateInstructionARM::EmulateMVNReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -2005,9 +2005,9 @@ return true; } -// Branch with Link and Exchange Instruction Sets (immediate) calls a subroutine -// at a PC-relative address, and changes instruction set from ARM to Thumb, or -// from Thumb to ARM. +// Branch with Link and Exchange Instruction Sets (immediate) calls a +// subroutine at a PC-relative address, and changes instruction set from ARM to +// Thumb, or from Thumb to ARM. // BLX (immediate) bool EmulateInstructionARM::EmulateBLXImmediate(const uint32_t opcode, const ARMEncoding encoding) { @@ -2110,8 +2110,8 @@ return true; } -// Branch with Link and Exchange (register) calls a subroutine at an address and -// instruction set specified by a register. +// Branch with Link and Exchange (register) calls a subroutine at an address +// and instruction set specified by a register. // BLX (register) bool EmulateInstructionARM::EmulateBLXRm(const uint32_t opcode, const ARMEncoding encoding) { @@ -2220,9 +2220,8 @@ } // Branch and Exchange Jazelle attempts to change to Jazelle state. If the -// attempt fails, it branches to an -// address and instruction set specified by a register as though it were a BX -// instruction. +// attempt fails, it branches to an address and instruction set specified by a +// register as though it were a BX instruction. // // TODO: Emulate Jazelle architecture? // We currently assume that switching to Jazelle state fails, thus @@ -2561,8 +2560,8 @@ return true; } -// Vector Push stores multiple extension registers to the stack. -// It also updates SP to point to the start of the stored data. +// Vector Push stores multiple extension registers to the stack. It also +// updates SP to point to the start of the stored data. bool EmulateInstructionARM::EmulateVPUSH(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -2577,7 +2576,8 @@ MemA[address,4] = S[d+r]; address = address+4; else for r = 0 to regs-1 - // Store as two word-aligned words in the correct order for current endianness. + // Store as two word-aligned words in the correct order for + // current endianness. MemA[address,4] = if BigEndian() then D[d+r]<63:32> else D[d+r]<31:0>; MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else D[d+r]<63:32>; address = address+8; @@ -2653,8 +2653,8 @@ return true; } -// Vector Pop loads multiple extension registers from the stack. -// It also updates SP to point just above the loaded data. +// Vector Pop loads multiple extension registers from the stack. It also +// updates SP to point just above the loaded data. bool EmulateInstructionARM::EmulateVPOP(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -2670,7 +2670,8 @@ else for r = 0 to regs-1 word1 = MemA[address,4]; word2 = MemA[address+4,4]; address = address+8; - // Combine the word-aligned words in the correct order for current endianness. + // Combine the word-aligned words in the correct order for + // current endianness. D[d+r] = if BigEndian() then word1:word2 else word2:word1; } #endif @@ -2892,10 +2893,8 @@ } // Compare and Branch on Nonzero and Compare and Branch on Zero compare the -// value in a register with -// zero and conditionally branch forward a constant value. They do not affect -// the condition flags. -// CBNZ, CBZ +// value in a register with zero and conditionally branch forward a constant +// value. They do not affect the condition flags. CBNZ, CBZ bool EmulateInstructionARM::EmulateCB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -2938,8 +2937,8 @@ return true; } -// Table Branch Byte causes a PC-relative forward branch using a table of single -// byte offsets. +// Table Branch Byte causes a PC-relative forward branch using a table of +// single byte offsets. // A base register provides a pointer to the table, and a second register // supplies an index into the table. // The branch length is twice the value of the byte returned from the table. @@ -2948,8 +2947,8 @@ // single halfword offsets. // A base register provides a pointer to the table, and a second register // supplies an index into the table. -// The branch length is twice the value of the halfword returned from the table. -// TBB, TBH +// The branch length is twice the value of the halfword returned from the +// table. TBB, TBH bool EmulateInstructionARM::EmulateTB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -2984,9 +2983,8 @@ return false; } - // Read the address of the table from the operand register Rn. - // The PC can be used, in which case the table immediately follows this - // instruction. + // Read the address of the table from the operand register Rn. The PC can + // be used, in which case the table immediately follows this instruction. uint32_t base = ReadCoreReg(Rn, &success); if (!success) return false; @@ -3023,8 +3021,8 @@ } // This instruction adds an immediate value to a register value, and writes the -// result to the destination register. -// It can optionally update the condition flags based on the result. +// result to the destination register. It can optionally update the condition +// flags based on the result. bool EmulateInstructionARM::EmulateADDImmThumb(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3145,8 +3143,8 @@ } // This instruction adds an immediate value to a register value, and writes the -// result to the destination -// register. It can optionally update the condition flags based on the result. +// result to the destination register. It can optionally update the condition +// flags based on the result. bool EmulateInstructionARM::EmulateADDImmARM(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3210,9 +3208,8 @@ } // This instruction adds a register value and an optionally-shifted register -// value, and writes the result -// to the destination register. It can optionally update the condition flags -// based on the result. +// value, and writes the result to the destination register. It can optionally +// update the condition flags based on the result. bool EmulateInstructionARM::EmulateADDReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3350,8 +3347,8 @@ } // Compare Negative (register) adds a register value and an optionally-shifted -// register value. -// It updates the condition flags based on the result, and discards the result. +// register value. It updates the condition flags based on the result, and +// discards the result. bool EmulateInstructionARM::EmulateCMNReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3419,8 +3416,8 @@ return true; } -// Compare (immediate) subtracts an immediate value from a register value. -// It updates the condition flags based on the result, and discards the result. +// Compare (immediate) subtracts an immediate value from a register value. It +// updates the condition flags based on the result, and discards the result. bool EmulateInstructionARM::EmulateCMPImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3473,8 +3470,8 @@ } // Compare (register) subtracts an optionally-shifted register value from a -// register value. -// It updates the condition flags based on the result, and discards the result. +// register value. It updates the condition flags based on the result, and +// discards the result. bool EmulateInstructionARM::EmulateCMPReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3552,10 +3549,9 @@ } // Arithmetic Shift Right (immediate) shifts a register value right by an -// immediate number of bits, -// shifting in copies of its sign bit, and writes the result to the destination -// register. It can -// optionally update the condition flags based on the result. +// immediate number of bits, shifting in copies of its sign bit, and writes the +// result to the destination register. It can optionally update the condition +// flags based on the result. bool EmulateInstructionARM::EmulateASRImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3577,13 +3573,11 @@ return EmulateShiftImm(opcode, encoding, SRType_ASR); } -// Arithmetic Shift Right (register) shifts a register value right by a variable -// number of bits, -// shifting in copies of its sign bit, and writes the result to the destination -// register. -// The variable number of bits is read from the bottom byte of a register. It -// can optionally update -// the condition flags based on the result. +// Arithmetic Shift Right (register) shifts a register value right by a +// variable number of bits, shifting in copies of its sign bit, and writes the +// result to the destination register. The variable number of bits is read from +// the bottom byte of a register. It can optionally update the condition flags +// based on the result. bool EmulateInstructionARM::EmulateASRReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3604,10 +3598,8 @@ } // Logical Shift Left (immediate) shifts a register value left by an immediate -// number of bits, -// shifting in zeros, and writes the result to the destination register. It can -// optionally -// update the condition flags based on the result. +// number of bits, shifting in zeros, and writes the result to the destination +// register. It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateLSLImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3630,12 +3622,9 @@ } // Logical Shift Left (register) shifts a register value left by a variable -// number of bits, -// shifting in zeros, and writes the result to the destination register. The -// variable number -// of bits is read from the bottom byte of a register. It can optionally update -// the condition -// flags based on the result. +// number of bits, shifting in zeros, and writes the result to the destination +// register. The variable number of bits is read from the bottom byte of a +// register. It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateLSLReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3655,11 +3644,10 @@ return EmulateShiftReg(opcode, encoding, SRType_LSL); } -// Logical Shift Right (immediate) shifts a register value right by an immediate -// number of bits, -// shifting in zeros, and writes the result to the destination register. It can -// optionally -// update the condition flags based on the result. +// Logical Shift Right (immediate) shifts a register value right by an +// immediate number of bits, shifting in zeros, and writes the result to the +// destination register. It can optionally update the condition flags based on +// the result. bool EmulateInstructionARM::EmulateLSRImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3682,12 +3670,9 @@ } // Logical Shift Right (register) shifts a register value right by a variable -// number of bits, -// shifting in zeros, and writes the result to the destination register. The -// variable number -// of bits is read from the bottom byte of a register. It can optionally update -// the condition -// flags based on the result. +// number of bits, shifting in zeros, and writes the result to the destination +// register. The variable number of bits is read from the bottom byte of a +// register. It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateLSRReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3708,10 +3693,9 @@ } // Rotate Right (immediate) provides the value of the contents of a register -// rotated by a constant value. -// The bits that are rotated off the right end are inserted into the vacated bit -// positions on the left. -// It can optionally update the condition flags based on the result. +// rotated by a constant value. The bits that are rotated off the right end are +// inserted into the vacated bit positions on the left. It can optionally +// update the condition flags based on the result. bool EmulateInstructionARM::EmulateRORImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3734,12 +3718,10 @@ } // Rotate Right (register) provides the value of the contents of a register -// rotated by a variable number of bits. -// The bits that are rotated off the right end are inserted into the vacated bit -// positions on the left. -// The variable number of bits is read from the bottom byte of a register. It -// can optionally update the condition -// flags based on the result. +// rotated by a variable number of bits. The bits that are rotated off the +// right end are inserted into the vacated bit positions on the left. The +// variable number of bits is read from the bottom byte of a register. It can +// optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateRORReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -3760,8 +3742,7 @@ } // Rotate Right with Extend provides the value of the contents of a register -// shifted right by one place, -// with the carry flag shifted into bit [31]. +// shifted right by one place, with the carry flag shifted into bit [31]. // // RRX can optionally update the condition flags based on the result. // In that case, bit [0] is shifted into the carry flag. @@ -3808,10 +3789,9 @@ // A8.6.139 ROR (immediate) -- Encoding T1 ARMEncoding use_encoding = encoding; if (shift_type == SRType_ROR && use_encoding == eEncodingT1) { - // Morph the T1 encoding from the ARM Architecture Manual into T2 encoding - // to - // have the same decoding of bit fields as the other Thumb2 shift - // operations. + // Morph the T1 encoding from the ARM Architecture Manual into T2 + // encoding to have the same decoding of bit fields as the other Thumb2 + // shift operations. use_encoding = eEncodingT2; } @@ -3950,8 +3930,7 @@ // LDM loads multiple registers from consecutive memory locations, using an // address from a base register. Optionally the address just above the highest -// of those locations -// can be written back to the base register. +// of those locations can be written back to the base register. bool EmulateInstructionARM::EmulateLDM(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4093,8 +4072,8 @@ // LDMDA loads multiple registers from consecutive memory locations using an // address from a base register. // The consecutive memory locations end at this address and the address just -// below the lowest of those locations -// can optionally be written back to the base register. +// below the lowest of those locations can optionally be written back to the +// base register. bool EmulateInstructionARM::EmulateLDMDA(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4210,8 +4189,8 @@ // LDMDB loads multiple registers from consecutive memory locations using an // address from a base register. The // consecutive memory locations end just below this address, and the address of -// the lowest of those locations can -// be optionally written back to the base register. +// the lowest of those locations can be optionally written back to the base +// register. bool EmulateInstructionARM::EmulateLDMDB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4349,8 +4328,8 @@ // LDMIB loads multiple registers from consecutive memory locations using an // address from a base register. The // consecutive memory locations start just above this address, and thea ddress -// of the last of those locations can -// optinoally be written back to the base register. +// of the last of those locations can optinoally be written back to the base +// register. bool EmulateInstructionARM::EmulateLDMIB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4461,8 +4440,7 @@ } // Load Register (immediate) calculates an address from a base register value -// and -// an immediate offset, loads a word from memory, and writes to a register. +// and an immediate offset, loads a word from memory, and writes to a register. // LDR (immediate, Thumb) bool EmulateInstructionARM::EmulateLDRRtRnImm(const uint32_t opcode, const ARMEncoding encoding) { @@ -4625,8 +4603,8 @@ // STM (Store Multiple Increment After) stores multiple registers to consecutive // memory locations using an address // from a base register. The consecutive memory locations start at this -// address, and the address just above the last -// of those locations can optionally be written back to the base register. +// address, and the address just above the last of those locations can +// optionally be written back to the base register. bool EmulateInstructionARM::EmulateSTM(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4775,10 +4753,10 @@ } // STMDA (Store Multiple Decrement After) stores multiple registers to -// consecutive memory locations using an address -// from a base register. The consecutive memory locations end at this address, -// and the address just below the lowest -// of those locations can optionally be written back to the base register. +// consecutive memory locations using an address from a base register. The +// consecutive memory locations end at this address, and the address just below +// the lowest of those locations can optionally be written back to the base +// register. bool EmulateInstructionARM::EmulateSTMDA(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -4897,10 +4875,10 @@ } // STMDB (Store Multiple Decrement Before) stores multiple registers to -// consecutive memory locations using an address -// from a base register. The consecutive memory locations end just below this -// address, and the address of the first of -// those locations can optionally be written back to the base register. +// consecutive memory locations using an address from a base register. The +// consecutive memory locations end just below this address, and the address of +// the first of those locations can optionally be written back to the base +// register. bool EmulateInstructionARM::EmulateSTMDB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5046,10 +5024,10 @@ } // STMIB (Store Multiple Increment Before) stores multiple registers to -// consecutive memory locations using an address -// from a base register. The consecutive memory locations start just above this -// address, and the address of the last -// of those locations can optionally be written back to the base register. +// consecutive memory locations using an address from a base register. The +// consecutive memory locations start just above this address, and the address +// of the last of those locations can optionally be written back to the base +// register. bool EmulateInstructionARM::EmulateSTMIB(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5337,8 +5315,8 @@ // STR (Store Register) calculates an address from a base register value and an // offset register value, stores a -// word from a register to memory. The offset register value can optionally be -// shifted. +// word from a register to memory. The offset register value can optionally +// be shifted. bool EmulateInstructionARM::EmulateSTRRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5423,7 +5401,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -5664,8 +5642,8 @@ // STRH (register) calculates an address from a base register value and an // offset register value, and stores a -// halfword from a register to memory. The offset register value can be shifted -// left by 0, 1, 2, or 3 bits. +// halfword from a register to memory. The offset register value can be +// shifted left by 0, 1, 2, or 3 bits. bool EmulateInstructionARM::EmulateSTRHRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5745,7 +5723,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -5842,10 +5820,8 @@ } // Add with Carry (immediate) adds an immediate value and the carry flag value -// to a register value, -// and writes the result to the destination register. It can optionally update -// the condition flags -// based on the result. +// to a register value, and writes the result to the destination register. It +// can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateADCImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5911,11 +5887,10 @@ return true; } -// Add with Carry (register) adds a register value, the carry flag value, and an -// optionally-shifted -// register value, and writes the result to the destination register. It can -// optionally update the -// condition flags based on the result. +// Add with Carry (register) adds a register value, the carry flag value, and +// an optionally-shifted register value, and writes the result to the +// destination register. It can optionally update the condition flags based on +// the result. bool EmulateInstructionARM::EmulateADCReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -5999,9 +5974,8 @@ return true; } -// This instruction adds an immediate value to the PC value to form a -// PC-relative address, -// and writes the result to the destination register. +// This instruction adds an immediate value to the PC value to form a PC- +// relative address, and writes the result to the destination register. bool EmulateInstructionARM::EmulateADR(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -6063,9 +6037,8 @@ } // This instruction performs a bitwise AND of a register value and an immediate -// value, and writes the result -// to the destination register. It can optionally update the condition flags -// based on the result. +// value, and writes the result to the destination register. It can optionally +// update the condition flags based on the result. bool EmulateInstructionARM::EmulateANDImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -6139,10 +6112,8 @@ } // This instruction performs a bitwise AND of a register value and an -// optionally-shifted register value, -// and writes the result to the destination register. It can optionally update -// the condition flags -// based on the result. +// optionally-shifted register value, and writes the result to the destination +// register. It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateANDReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -6230,10 +6201,9 @@ } // Bitwise Bit Clear (immediate) performs a bitwise AND of a register value and -// the complement of an -// immediate value, and writes the result to the destination register. It can -// optionally update the -// condition flags based on the result. +// the complement of an immediate value, and writes the result to the +// destination register. It can optionally update the condition flags based on +// the result. bool EmulateInstructionARM::EmulateBICImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -6306,10 +6276,9 @@ } // Bitwise Bit Clear (register) performs a bitwise AND of a register value and -// the complement of an -// optionally-shifted register value, and writes the result to the destination -// register. -// It can optionally update the condition flags based on the result. +// the complement of an optionally-shifted register value, and writes the +// result to the destination register. It can optionally update the condition +// flags based on the result. bool EmulateInstructionARM::EmulateBICReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -6439,7 +6408,7 @@ n = Bits32(opcode, 19, 16); imm32 = Bits32(opcode, 11, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -6624,7 +6593,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -6661,8 +6630,8 @@ addr_t offset_addr; addr_t address; - // offset = Shift(R[m], shift_t, shift_n, APSR.C); -- Note "The APSR is an - // application level alias for the CPSR". + // offset = Shift(R[m], shift_t, shift_n, APSR.C); -- Note "The APSR is + // an application level alias for the CPSR". addr_t offset = Shift(Rm, shift_t, shift_n, Bit32(m_opcode_cpsr, APSR_C), &success); if (!success) @@ -6968,9 +6937,8 @@ } // LDRB (register) calculates an address from a base register value and an -// offset rigister value, loads a byte from -// memory, zero-extends it to form a 32-bit word, and writes it to a register. -// The offset register value can +// offset rigister value, loads a byte from memory, zero-extends it to form a +// 32-bit word, and writes it to a register. The offset register value can // optionally be shifted. bool EmulateInstructionARM::EmulateLDRBRegister(const uint32_t opcode, const ARMEncoding encoding) { @@ -7049,7 +7017,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -7132,9 +7100,8 @@ // LDRH (immediate, Thumb) calculates an address from a base register value and // an immediate offset, loads a -// halfword from memory, zero-extends it to form a 32-bit word, and writes it to -// a register. It can use offset, -// post-indexed, or pre-indexed addressing. +// halfword from memory, zero-extends it to form a 32-bit word, and writes it +// to a register. It can use offset, post-indexed, or pre-indexed addressing. bool EmulateInstructionARM::EmulateLDRHImmediate(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -7384,8 +7351,8 @@ // LDRH (literal) calculates an address from a base register value and an offset // register value, loads a halfword // from memory, zero-extends it to form a 32-bit word, and writes it to a -// register. The offset register value can -// be shifted left by 0, 1, 2, or 3 bits. +// register. The offset register value can be shifted left by 0, 1, 2, or 3 +// bits. bool EmulateInstructionARM::EmulateLDRHRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -7464,7 +7431,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -7561,8 +7528,7 @@ // LDRSB (immediate) calculates an address from a base register value and an // immediate offset, loads a byte from // memory, sign-extends it to form a 32-bit word, and writes it to a register. -// It can use offset, post-indexed, -// or pre-indexed addressing. +// It can use offset, post-indexed, or pre-indexed addressing. bool EmulateInstructionARM::EmulateLDRSBImmediate(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -7643,7 +7609,7 @@ uint32_t imm4L = Bits32(opcode, 3, 0); imm32 = (imm4H << 4) | imm4L; - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -7799,8 +7765,7 @@ // LDRSB (register) calculates an address from a base register value and an // offset register value, loadsa byte from // memory, sign-extends it to form a 32-bit word, and writes it to a register. -// The offset register value can be -// shifted left by 0, 1, 2, or 3 bits. +// The offset register value can be shifted left by 0, 1, 2, or 3 bits. bool EmulateInstructionARM::EmulateLDRSBRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -7873,7 +7838,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -7960,8 +7925,7 @@ // LDRSH (immediate) calculates an address from a base register value and an // immediate offset, loads a halfword from // memory, sign-extends it to form a 32-bit word, and writes it to a register. -// It can use offset, post-indexed, or -// pre-indexed addressing. +// It can use offset, post-indexed, or pre-indexed addressing. bool EmulateInstructionARM::EmulateLDRSHImmediate(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -8043,7 +8007,7 @@ uint32_t imm4L = Bits32(opcode, 3, 0); imm32 = (imm4H << 4) | imm4L; - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -8220,8 +8184,8 @@ // LDRSH (register) calculates an address from a base register value and an // offset register value, loads a halfword // from memory, sign-extends it to form a 32-bit word, and writes it to a -// register. The offset register value can be -// shifted left by 0, 1, 2, or 3 bits. +// register. The offset register value can be shifted left by 0, 1, 2, or 3 +// bits. bool EmulateInstructionARM::EmulateLDRSHRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -8301,7 +8265,7 @@ n = Bits32(opcode, 19, 16); m = Bits32(opcode, 3, 0); - // index = (P == '1'); add = (U == '1'); wback = (P == '0') || + // index = (P == '1'); add = (U == '1'); wback = (P == '0') || // (W == '1'); index = BitIsSet(opcode, 24); add = BitIsSet(opcode, 23); @@ -8879,9 +8843,8 @@ } // Bitwise Exclusive OR (immediate) performs a bitwise exclusive OR of a -// register value and an immediate value, -// and writes the result to the destination register. It can optionally update -// the condition flags based on +// register value and an immediate value, and writes the result to the +// destination register. It can optionally update the condition flags based on // the result. bool EmulateInstructionARM::EmulateEORImm(const uint32_t opcode, const ARMEncoding encoding) { @@ -8957,11 +8920,10 @@ return true; } -// Bitwise Exclusive OR (register) performs a bitwise exclusive OR of a register -// value and an -// optionally-shifted register value, and writes the result to the destination -// register. -// It can optionally update the condition flags based on the result. +// Bitwise Exclusive OR (register) performs a bitwise exclusive OR of a +// register value and an optionally-shifted register value, and writes the +// result to the destination register. It can optionally update the condition +// flags based on the result. bool EmulateInstructionARM::EmulateEORReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9051,10 +9013,8 @@ } // Bitwise OR (immediate) performs a bitwise (inclusive) OR of a register value -// and an immediate value, and -// writes the result to the destination register. It can optionally update the -// condition flags based -// on the result. +// and an immediate value, and writes the result to the destination register. +// It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateORRImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9128,10 +9088,9 @@ } // Bitwise OR (register) performs a bitwise (inclusive) OR of a register value -// and an optionally-shifted register -// value, and writes the result to the destination register. It can optionally -// update the condition flags based -// on the result. +// and an optionally-shifted register value, and writes the result to the +// destination register. It can optionally update the condition flags based on +// the result. bool EmulateInstructionARM::EmulateORRReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9219,9 +9178,8 @@ } // Reverse Subtract (immediate) subtracts a register value from an immediate -// value, and writes the result to -// the destination register. It can optionally update the condition flags based -// on the result. +// value, and writes the result to the destination register. It can optionally +// update the condition flags based on the result. bool EmulateInstructionARM::EmulateRSBImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9294,10 +9252,9 @@ return true; } -// Reverse Subtract (register) subtracts a register value from an -// optionally-shifted register value, and writes the -// result to the destination register. It can optionally update the condition -// flags based on the result. +// Reverse Subtract (register) subtracts a register value from an optionally- +// shifted register value, and writes the result to the destination register. +// It can optionally update the condition flags based on the result. bool EmulateInstructionARM::EmulateRSBReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9377,10 +9334,9 @@ } // Reverse Subtract with Carry (immediate) subtracts a register value and the -// value of NOT (Carry flag) from -// an immediate value, and writes the result to the destination register. It can -// optionally update the condition -// flags based on the result. +// value of NOT (Carry flag) from an immediate value, and writes the result to +// the destination register. It can optionally update the condition flags based +// on the result. bool EmulateInstructionARM::EmulateRSCImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9440,9 +9396,8 @@ } // Reverse Subtract with Carry (register) subtracts a register value and the -// value of NOT (Carry flag) from an -// optionally-shifted register value, and writes the result to the destination -// register. It can optionally update the +// value of NOT (Carry flag) from an optionally-shifted register value, and +// writes the result to the destination register. It can optionally update the // condition flags based on the result. bool EmulateInstructionARM::EmulateRSCReg(const uint32_t opcode, const ARMEncoding encoding) { @@ -9512,7 +9467,8 @@ return true; } -// Subtract with Carry (immediate) subtracts an immediate value and the value of +// Subtract with Carry (immediate) subtracts an immediate value and the value +// of // NOT (Carry flag) from a register value, and writes the result to the // destination register. // It can optionally update the condition flags based on the result. @@ -9582,8 +9538,8 @@ return true; } -// Subtract with Carry (register) subtracts an optionally-shifted register value -// and the value of +// Subtract with Carry (register) subtracts an optionally-shifted register +// value and the value of // NOT (Carry flag) from a register value, and writes the result to the // destination register. // It can optionally update the condition flags based on the result. @@ -9672,9 +9628,8 @@ } // This instruction subtracts an immediate value from a register value, and -// writes the result -// to the destination register. It can optionally update the condition flags -// based on the result. +// writes the result to the destination register. It can optionally update the +// condition flags based on the result. bool EmulateInstructionARM::EmulateSUBImmThumb(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9766,9 +9721,8 @@ } // This instruction subtracts an immediate value from a register value, and -// writes the result -// to the destination register. It can optionally update the condition flags -// based on the result. +// writes the result to the destination register. It can optionally update the +// condition flags based on the result. bool EmulateInstructionARM::EmulateSUBImmARM(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9844,9 +9798,8 @@ } // Test Equivalence (immediate) performs a bitwise exclusive OR operation on a -// register value and an -// immediate value. It updates the condition flags based on the result, and -// discards the result. +// register value and an immediate value. It updates the condition flags based +// on the result, and discards the result. bool EmulateInstructionARM::EmulateTEQImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9904,10 +9857,8 @@ } // Test Equivalence (register) performs a bitwise exclusive OR operation on a -// register value and an -// optionally-shifted register value. It updates the condition flags based on -// the result, and discards -// the result. +// register value and an optionally-shifted register value. It updates the +// condition flags based on the result, and discards the result. bool EmulateInstructionARM::EmulateTEQReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -9972,8 +9923,8 @@ } // Test (immediate) performs a bitwise AND operation on a register value and an -// immediate value. -// It updates the condition flags based on the result, and discards the result. +// immediate value. It updates the condition flags based on the result, and +// discards the result. bool EmulateInstructionARM::EmulateTSTImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -10031,8 +9982,8 @@ } // Test (register) performs a bitwise AND operation on a register value and an -// optionally-shifted register value. -// It updates the condition flags based on the result, and discards the result. +// optionally-shifted register value. It updates the condition flags based on +// the result, and discards the result. bool EmulateInstructionARM::EmulateTSTReg(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -10403,9 +10354,8 @@ AddWithCarryResult res = AddWithCarry(Rn, ~shifted, 1); - // if d == 15 then // Can only occur for ARM encoding - // ALUWritePC(result); // setflags is always FALSE here - // else + // if d == 15 then // Can only occur for ARM encoding ALUWritePC(result); + // // setflags is always FALSE here else // R[d] = result; // if setflags then // APSR.N = result<31>; @@ -10429,10 +10379,9 @@ } // A8.6.202 STREX -// Store Register Exclusive calculates an address from a base register value and -// an immediate offset, and stores a -// word from a register to memory if the executing processor has exclusive -// access to the memory addressed. +// Store Register Exclusive calculates an address from a base register value +// and an immediate offset, and stores a word from a register to memory if the +// executing processor has exclusive access to the memory addressed. bool EmulateInstructionARM::EmulateSTREX(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -10457,7 +10406,8 @@ switch (encoding) { case eEncodingT1: - // d = UInt(Rd); t = UInt(Rt); n = UInt(Rn); imm32 = ZeroExtend(imm8:'00', + // d = UInt(Rd); t = UInt(Rt); n = UInt(Rn); imm32 = + // ZeroExtend(imm8:'00', // 32); d = Bits32(opcode, 11, 8); t = Bits32(opcode, 15, 12); @@ -10511,9 +10461,9 @@ context.type = eContextRegisterStore; context.SetRegisterToRegisterPlusOffset(data_reg, base_reg, imm32); - // if ExclusiveMonitorsPass(address,4) then - // if (ExclusiveMonitorsPass (address, addr_byte_size)) -- For now, for the - // sake of emulation, we will say this + // if ExclusiveMonitorsPass(address,4) then if (ExclusiveMonitorsPass + // (address, addr_byte_size)) -- For now, for the sake of emulation, we + // will say this // always return // true. if (true) { @@ -10742,9 +10692,9 @@ // A8.6.66 LDRD (immediate) // Load Register Dual (immediate) calculates an address from a base register -// value and an immediate offset, loads two -// words from memory, and writes them to two registers. It can use offset, -// post-indexed, or pre-indexed addressing. +// value and an immediate offset, loads two words from memory, and writes them +// to two registers. It can use offset, post-indexed, or pre-indexed +// addressing. bool EmulateInstructionARM::EmulateLDRDImmediate(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -10891,9 +10841,8 @@ // A8.6.68 LDRD (register) // Load Register Dual (register) calculates an address from a base register -// value and a register offset, loads two -// words from memory, and writes them to two registers. It can use offset, -// post-indexed or pre-indexed addressing. +// value and a register offset, loads two words from memory, and writes them to +// two registers. It can use offset, post-indexed or pre-indexed addressing. bool EmulateInstructionARM::EmulateLDRDRegister(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -11021,9 +10970,8 @@ // A8.6.200 STRD (immediate) // Store Register Dual (immediate) calculates an address from a base register -// value and an immediate offset, and -// stores two words from two registers to memory. It can use offset, -// post-indexed, or pre-indexed addressing. +// value and an immediate offset, and stores two words from two registers to +// memory. It can use offset, post-indexed, or pre-indexed addressing. bool EmulateInstructionARM::EmulateSTRDImm(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -11314,8 +11262,7 @@ // A8.6.319 VLDM // Vector Load Multiple loads multiple extension registers from consecutive -// memory locations using an address from -// an ARM core register. +// memory locations using an address from an ARM core register. bool EmulateInstructionARM::EmulateVLDM(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -11328,7 +11275,8 @@ S[d+r] = MemA[address,4]; address = address+4; else word1 = MemA[address,4]; word2 = MemA[address+4,4]; address = address+8; - // Combine the word-aligned words in the correct order for current endianness. + // Combine the word-aligned words in the correct order for + // current endianness. D[d+r] = if BigEndian() then word1:word2 else word2:word1; #endif @@ -11389,8 +11337,8 @@ return false; // // Remaining combinations are PUW = 010 (IA without !), 011 (IA with - // !), 101 (DB with !) - // single_regs = TRUE; add = (U == '1'); wback = (W == '1'); d = + // !), 101 (DB with !) single_regs = TRUE; add = (U == '1'); wback = (W + // == '1'); d = // UInt(Vd:D); n = UInt(Rn); single_regs = true; add = BitIsSet(opcode, 23); @@ -11519,7 +11467,8 @@ if single_regs then MemA[address,4] = S[d+r]; address = address+4; else - // Store as two word-aligned words in the correct order for current endianness. + // Store as two word-aligned words in the correct order for + // current endianness. MemA[address,4] = if BigEndian() then D[d+r]<63:32> else D[d+r]<31:0>; MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else D[d+r]<63:32>; address = address+8; @@ -11582,8 +11531,8 @@ return false; // // Remaining combinations are PUW = 010 (IA without !), 011 (IA with - // !), 101 (DB with !) - // single_regs = TRUE; add = (U == '1'); wback = (W == '1'); d = + // !), 101 (DB with !) single_regs = TRUE; add = (U == '1'); wback = (W + // == '1'); d = // UInt(Vd:D); n = UInt(Rn); single_regs = true; add = BitIsSet(opcode, 23); @@ -11665,8 +11614,7 @@ address = address + 4; } else { // // Store as two word-aligned words in the correct order for current - // endianness. - // MemA[address,4] = if BigEndian() then D[d+r]<63:32> else + // endianness. MemA[address,4] = if BigEndian() then D[d+r]<63:32> else // D[d+r]<31:0>; // MemA[address+4,4] = if BigEndian() then D[d+r]<31:0> else // D[d+r]<63:32>; @@ -11712,8 +11660,7 @@ // A8.6.320 // This instruction loads a single extension register from memory, using an -// address from an ARM core register, with -// an optional offset. +// address from an ARM core register, with an optional offset. bool EmulateInstructionARM::EmulateVLDR(const uint32_t opcode, ARMEncoding encoding) { #if 0 @@ -11725,7 +11672,8 @@ S[d] = MemA[address,4]; else word1 = MemA[address,4]; word2 = MemA[address+4,4]; - // Combine the word-aligned words in the correct order for current endianness. + // Combine the word-aligned words in the correct order for current + // endianness. D[d] = if BigEndian() then word1:word2 else word2:word1; #endif @@ -11839,8 +11787,7 @@ // A8.6.400 VSTR // This instruction stores a signle extension register to memory, using an -// address from an ARM core register, with an -// optional offset. +// address from an ARM core register, with an optional offset. bool EmulateInstructionARM::EmulateVSTR(const uint32_t opcode, ARMEncoding encoding) { #if 0 @@ -11850,7 +11797,8 @@ if single_reg then MemA[address,4] = S[d]; else - // Store as two word-aligned words in the correct order for current endianness. + // Store as two word-aligned words in the correct order for current + // endianness. MemA[address,4] = if BigEndian() then D[d]<63:32> else D[d]<31:0>; MemA[address+4,4] = if BigEndian() then D[d]<31:0> else D[d]<63:32>; #endif @@ -11970,10 +11918,9 @@ return true; } -// A8.6.307 VLDI1 (multiple single elements) -// This instruction loads elements from memory into one, two, three or four -// registers, without de-interleaving. Every -// element of each register is loaded. +// A8.6.307 VLDI1 (multiple single elements) This instruction loads elements +// from memory into one, two, three or four registers, without de-interleaving. +// Every element of each register is loaded. bool EmulateInstructionARM::EmulateVLD1Multiple(const uint32_t opcode, ARMEncoding encoding) { #if 0 @@ -12291,8 +12238,7 @@ if (index > 0) mask = mask | Bits64(all_ones, (index * esize) - 1, 0); // add 1's to the right of where 'element' goes. - // now mask should be 0's where element goes & 1's - // everywhere else. + // now mask should be 0's where element goes & 1's everywhere else. uint64_t masked_reg = reg_data & mask; // Take original reg value & zero out 'element' bits @@ -12307,10 +12253,9 @@ return true; } -// A8.6.391 VST1 (multiple single elements) -// Vector Store (multiple single elements) stores elements to memory from one, -// two, three, or four registers, without -// interleaving. Every element of each register is stored. +// A8.6.391 VST1 (multiple single elements) Vector Store (multiple single +// elements) stores elements to memory from one, two, three, or four registers, +// without interleaving. Every element of each register is stored. bool EmulateInstructionARM::EmulateVST1Multiple(const uint32_t opcode, ARMEncoding encoding) { #if 0 @@ -12465,8 +12410,8 @@ return true; } -// A8.6.392 VST1 (single element from one lane) -// This instruction stores one element to memory from one element of a register. +// A8.6.392 VST1 (single element from one lane) This instruction stores one +// element to memory from one element of a register. bool EmulateInstructionARM::EmulateVST1Single(const uint32_t opcode, ARMEncoding encoding) { #if 0 @@ -12624,9 +12569,8 @@ return true; } -// A8.6.309 VLD1 (single element to all lanes) -// This instruction loads one element from memory into every element of one or -// two vectors. +// A8.6.309 VLD1 (single element to all lanes) This instruction loads one +// element from memory into every element of one or two vectors. bool EmulateInstructionARM::EmulateVLD1SingleAll(const uint32_t opcode, const ARMEncoding encoding) { #if 0 @@ -12754,11 +12698,10 @@ return true; } -// B6.2.13 SUBS PC, LR and related instructions -// The SUBS PC, LR, #= ARMv7); } -// The main addition and subtraction instructions can produce status information -// about both unsigned carry and signed overflow conditions. This status -// information can be used to synthesize multi-word additions and subtractions. +// The main addition and subtraction instructions can produce status +// information about both unsigned carry and signed overflow conditions. This +// status information can be used to synthesize multi-word additions and +// subtractions. EmulateInstructionARM::AddWithCarryResult EmulateInstructionARM::AddWithCarry(uint32_t x, uint32_t y, uint8_t carry_in) { uint32_t result; @@ -14364,9 +14305,8 @@ uint32_t val = ReadRegisterUnsigned(reg_kind, reg_num, 0, success); // When executing an ARM instruction , PC reads as the address of the current - // instruction plus 8. - // When executing a Thumb instruction , PC reads as the address of the current - // instruction plus 4. + // instruction plus 8. When executing a Thumb instruction , PC reads as the + // address of the current instruction plus 4. if (num == 15) { if (CurrentInstrSet() == eModeARM) val += 8; @@ -14434,8 +14374,7 @@ // APSR.V = overflow // // Default arguments can be specified for carry and overflow parameters, which -// means -// not to update the respective flags. +// means not to update the respective flags. bool EmulateInstructionARM::WriteFlags(Context &context, const uint32_t result, const uint32_t carry, const uint32_t overflow) { @@ -14496,8 +14435,7 @@ } // Advance the ITSTATE bits to their values for the next instruction if we - // haven't just executed - // an IT instruction what initialized it. + // haven't just executed an IT instruction what initialized it. if (m_opcode_mode == eModeThumb && m_it_session.InITBlock() && (opcode_data == nullptr || opcode_data->callback != &EmulateInstructionARM::EmulateIT)) Index: lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp =================================================================== --- lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp +++ lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp @@ -506,8 +506,8 @@ bool EmulateInstructionARM64::BranchTo(const Context &context, uint32_t N, addr_t target) { #if 0 - // Set program counter to a new address, with a branch reason hint - // for possible use by hardware fetching the next instruction. + // Set program counter to a new address, with a branch reason hint for + // possible use by hardware fetching the next instruction. BranchTo(bits(N) target, BranchType branch_type) Hint_Branch(branch_type); if N == 32 then @@ -555,10 +555,9 @@ } bool EmulateInstructionARM64::ConditionHolds(const uint32_t cond) { - // If we are ignoring conditions, then always return true. - // this allows us to iterate over disassembly code and still - // emulate an instruction even if we don't have all the right - // bits set in the CPSR register... + // If we are ignoring conditions, then always return true. this allows us to + // iterate over disassembly code and still emulate an instruction even if we + // don't have all the right bits set in the CPSR register... if (m_ignore_conditions) return true; @@ -690,8 +689,8 @@ context.SetRegisterPlusOffset(reg_info_Rn, imm); if (n == GetFramePointerRegisterNumber() && d == gpr_sp_arm64 && !setflags) { - // 'mov sp, fp' - common epilogue instruction, CFA is now in terms - // of the stack pointer, instead of frame pointer. + // 'mov sp, fp' - common epilogue instruction, CFA is now in terms of the + // stack pointer, instead of frame pointer. context.type = EmulateInstruction::eContextRestoreStackPointer; } else if ((n == gpr_sp_arm64 || n == GetFramePointerRegisterNumber()) && d == gpr_sp_arm64 && !setflags) { Index: lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp =================================================================== --- lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp +++ lldb/trunk/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp @@ -1205,13 +1205,10 @@ dst = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); src = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); - // If immediate value is greater then 2^16 - 1 then clang generate - // LUI, ADDIU, SUBU instructions in prolog. - // Example - // lui $1, 0x2 - // addiu $1, $1, -0x5920 - // subu $sp, $sp, $1 - // In this case, ADDIU dst and src will be same and not equal to sp + // If immediate value is greater then 2^16 - 1 then clang generate LUI, + // ADDIU, SUBU instructions in prolog. Example lui $1, 0x2 addiu $1, $1, + // -0x5920 subu $sp, $sp, $1 In this case, ADDIU dst and src will be same + // and not equal to sp if (dst == src) { Context context; @@ -1545,8 +1542,8 @@ address = address + imm5; // We use bad_vaddr_context to store base address which is used by H/W - // watchpoint - // Set the bad_vaddr register with base address used in the instruction + // watchpoint Set the bad_vaddr register with base address used in the + // instruction bad_vaddr_context.type = eContextInvalid; WriteRegisterUnsigned(bad_vaddr_context, eRegisterKindDWARF, dwarf_bad_mips, address); @@ -1682,8 +1679,8 @@ base_address = base_address + imm5; // We use bad_vaddr_context to store base address which is used by H/W - // watchpoint - // Set the bad_vaddr register with base address used in the instruction + // watchpoint Set the bad_vaddr register with base address used in the + // instruction bad_vaddr_context.type = eContextInvalid; WriteRegisterUnsigned(bad_vaddr_context, eRegisterKindDWARF, dwarf_bad_mips, base_address); Index: lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp =================================================================== --- lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp +++ lldb/trunk/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp @@ -1091,13 +1091,10 @@ dst = m_reg_info->getEncodingValue(insn.getOperand(0).getReg()); src = m_reg_info->getEncodingValue(insn.getOperand(1).getReg()); - // If immediate is greater than 2^16 - 1 then clang generate - // LUI, (D)ADDIU,(D)SUBU instructions in prolog. - // Example - // lui $1, 0x2 - // daddiu $1, $1, -0x5920 - // dsubu $sp, $sp, $1 - // In this case, (D)ADDIU dst and src will be same and not equal to sp + // If immediate is greater than 2^16 - 1 then clang generate LUI, + // (D)ADDIU,(D)SUBU instructions in prolog. Example lui $1, 0x2 daddiu $1, + // $1, -0x5920 dsubu $sp, $sp, $1 In this case, (D)ADDIU dst and src will be + // same and not equal to sp if (dst == src) { Context context; Index: lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp =================================================================== --- lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp +++ lldb/trunk/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp @@ -248,8 +248,8 @@ int32_t ids = llvm::SignExtend32<16>(ds << 2); - // For now, tracking only loads from 0(r1) to r1 - // (0(r1) is the ABI defined location to save previous SP) + // For now, tracking only loads from 0(r1) to r1 (0(r1) is the ABI defined + // location to save previous SP) if (ra != gpr_r1_ppc64le || rt != gpr_r1_ppc64le || ids != 0) return false; @@ -294,8 +294,8 @@ LLDB_LOG(log, "EmulateSTD: {0:X+8}: std{1} r{2}, {3}(r{4})", m_addr, u ? "u" : "", rs, ids, ra); - // Make sure that r0 is really holding LR value - // (this won't catch unlikely cases, such as r0 being overwritten after mfspr) + // Make sure that r0 is really holding LR value (this won't catch unlikely + // cases, such as r0 being overwritten after mfspr) uint32_t rs_num = rs; if (rs == gpr_r0_ppc64le) { uint64_t lr = Index: lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp +++ lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker/MainThreadCheckerRuntime.cpp @@ -267,8 +267,8 @@ new HistoryThread(*process_sp, tid, PCs, stop_id, stop_id_is_valid); ThreadSP new_thread_sp(history_thread); - // Save this in the Process' ExtendedThreadList so a strong pointer - // retains the object + // Save this in the Process' ExtendedThreadList so a strong pointer retains + // the object process_sp->GetExtendedThreadList().AddThread(new_thread_sp); threads->AddThread(new_thread_sp); Index: lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp +++ lldb/trunk/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp @@ -282,9 +282,8 @@ } else { // This isn't a live thread anymore. Ask process to assign a new // Index ID (or return an old one if we've already seen this - // thread_os_id). - // It will also make sure that no new threads are assigned this Index - // ID. + // thread_os_id). It will also make sure that no new threads are + // assigned this Index ID. lldb_user_id = process_sp->AssignIndexIDToThread(thread_os_id); } Index: lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp +++ lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp @@ -334,8 +334,8 @@ std::string stop_reason_description = GetStopReasonDescription(info); new_thread_sp->SetName(stop_reason_description.c_str()); - // Save this in the Process' ExtendedThreadList so a strong pointer - // retains the object + // Save this in the Process' ExtendedThreadList so a strong pointer retains + // the object process_sp->GetExtendedThreadList().AddThread(new_thread_sp); threads->AddThread(new_thread_sp); Index: lldb/trunk/source/Plugins/Language/CPlusPlus/BlockPointer.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/BlockPointer.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/BlockPointer.cpp @@ -147,9 +147,8 @@ return child_sp; } - // return true if this object is now safe to use forever without - // ever updating again; the typical (and tested) answer here is - // 'false' + // return true if this object is now safe to use forever without ever + // updating again; the typical (and tested) answer here is 'false' bool Update() override { return false; } // maybe return false if the block pointer is, say, null Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -120,10 +120,9 @@ static bool IsTrivialBasename(const llvm::StringRef &basename) { // Check that the basename matches with the following regular expression - // "^~?([A-Za-z_][A-Za-z_0-9]*)$" - // We are using a hand written implementation because it is significantly more - // efficient then - // using the general purpose regular expression library. + // "^~?([A-Za-z_][A-Za-z_0-9]*)$" We are using a hand written implementation + // because it is significantly more efficient then using the general purpose + // regular expression library. size_t idx = 0; if (basename.size() > 0 && basename[0] == '~') idx = 1; @@ -151,10 +150,9 @@ } bool CPlusPlusLanguage::MethodName::TrySimplifiedParse() { - // This method tries to parse simple method definitions - // which are presumably most comman in user programs. - // Definitions that can be parsed by this function don't have return types - // and templates in the name. + // This method tries to parse simple method definitions which are presumably + // most comman in user programs. Definitions that can be parsed by this + // function don't have return types and templates in the name. // A::B::C::fun(std::vector &) const size_t arg_start, arg_end; llvm::StringRef full(m_full.GetCString()); @@ -251,8 +249,8 @@ } bool CPlusPlusLanguage::IsCPPMangledName(const char *name) { - // FIXME!! we should really run through all the known C++ Language - // plugins and ask each one if this is a C++ mangled name + // FIXME!! we should really run through all the known C++ Language plugins + // and ask each one if this is a C++ mangled name if (name == nullptr) return false; Index: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp @@ -25,8 +25,8 @@ m_next_token_index = 0; Optional result(None); - // Try to parse the name as function without a return type specified - // e.g. main(int, char*[]) + // Try to parse the name as function without a return type specified e.g. + // main(int, char*[]) { Bookmark start_position = SetBookmark(); result = ParseFunctionImpl(false); @@ -34,8 +34,8 @@ return result; } - // Try to parse the name as function with function pointer return type - // e.g. void (*get_func(const char*))() + // Try to parse the name as function with function pointer return type e.g. + // void (*get_func(const char*))() result = ParseFuncPtr(true); if (result) return result; @@ -183,13 +183,13 @@ Advance(); // Consuming template arguments is a bit trickier than consuming function - // arguments, because '<' '>' brackets are not always trivially balanced. - // In some rare cases tokens '<' and '>' can appear inside template arguments - // as arithmetic or shift operators not as template brackets. - // Examples: std::enable_if<(10u)<(64), bool> + // arguments, because '<' '>' brackets are not always trivially balanced. In + // some rare cases tokens '<' and '>' can appear inside template arguments as + // arithmetic or shift operators not as template brackets. Examples: + // std::enable_if<(10u)<(64), bool> // f> - // Good thing that compiler makes sure that really ambiguous cases of - // '>' usage should be enclosed within '()' brackets. + // Good thing that compiler makes sure that really ambiguous cases of '>' + // usage should be enclosed within '()' brackets. int template_counter = 1; bool can_open_template = false; while (HasMoreTokens() && template_counter > 0) { @@ -208,9 +208,9 @@ case tok::less: // '<' is an attempt to open a subteamplte // check if parser is at the point where it's actually possible, - // otherwise it's just a part of an expression like 'sizeof(T)<(10)'. - // No need to do the same for '>' because compiler actually makes sure - // that '>' always surrounded by brackets to avoid ambiguity. + // otherwise it's just a part of an expression like 'sizeof(T)<(10)'. No + // need to do the same for '>' because compiler actually makes sure that + // '>' always surrounded by brackets to avoid ambiguity. if (can_open_template) ++template_counter; can_open_template = false; @@ -388,10 +388,9 @@ bool CPlusPlusNameParser::ConsumeBuiltinType() { bool result = false; bool continue_parsing = true; - // Built-in types can be made of a few keywords - // like 'unsigned long long int'. This function - // consumes all built-in type keywords without - // checking if they make sense like 'unsigned char void'. + // Built-in types can be made of a few keywords like 'unsigned long long + // int'. This function consumes all built-in type keywords without checking + // if they make sense like 'unsigned char void'. while (continue_parsing && HasMoreTokens()) { switch (Peek().getKind()) { case tok::kw_short: Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -123,12 +123,11 @@ static ConstString g___i_("__i_"); - // this must be a ValueObject* because it is a child of the ValueObject we are - // producing children for - // it if were a ValueObjectSP, we would end up with a loop (iterator -> - // synthetic -> child -> parent == iterator) - // and that would in turn leak memory by never allowing the ValueObjects to - // die and free their memory + // this must be a ValueObject* because it is a child of the ValueObject we + // are producing children for it if were a ValueObjectSP, we would end up + // with a loop (iterator -> synthetic -> child -> parent == iterator) and + // that would in turn leak memory by never allowing the ValueObjects to die + // and free their memory m_pair_ptr = valobj_sp ->GetValueForExpressionPath( ".__i_.__ptr_->__value_", nullptr, nullptr, @@ -386,7 +385,8 @@ }; // this function abstracts away the layout and mode details of a libc++ string -// and returns the address of the data and the size ready for callers to consume +// and returns the address of the data and the size ready for callers to +// consume static bool ExtractLibcxxStringInfo(ValueObject &valobj, ValueObjectSP &location_sp, uint64_t &size) { Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -206,8 +206,7 @@ if (m_loop_detected == 0) { // This is the first time we are being run (after the last update). Set up - // the loop - // invariant for the first element. + // the loop invariant for the first element. m_slow_runner = ListEntry(m_head).next(); m_fast_runner = m_slow_runner.next(); m_loop_detected = 1; @@ -215,9 +214,8 @@ // Loop invariant: // Loop detection has been run over the first m_loop_detected elements. If - // m_slow_runner == - // m_fast_runner then the loop has been detected after m_loop_detected - // elements. + // m_slow_runner == m_fast_runner then the loop has been detected after + // m_loop_detected elements. const size_t steps_to_run = std::min(count, m_count); while (m_loop_detected < steps_to_run && m_slow_runner && m_fast_runner && m_slow_runner != m_fast_runner) { Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp @@ -382,8 +382,8 @@ return lldb::ValueObjectSP(); } } else { - // because of the way our debug info is made, we need to read item 0 first - // so that we can cache information used to generate other elements + // because of the way our debug info is made, we need to read item 0 + // first so that we can cache information used to generate other elements if (m_skip_size == UINT32_MAX) GetChildAtIndex(0); if (m_skip_size == UINT32_MAX) { Index: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp +++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp @@ -71,8 +71,8 @@ ValueObjectSP obj_subchild_sp = obj_child_sp->GetChildMemberWithName(ConstString("_M_t"), true); - // if there is a _M_t subchild, the tuple is found in - // the obj_subchild_sp (for libstdc++ 6.0.23). + // if there is a _M_t subchild, the tuple is found in the obj_subchild_sp + // (for libstdc++ 6.0.23). if (obj_subchild_sp) { return obj_subchild_sp; } Index: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp +++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp @@ -766,9 +766,9 @@ stream.Printf("0001-12-30 00:00:00 +0000"); return true; } - // this snippet of code assumes that time_t == seconds since Jan-1-1970 - // this is generally true and POSIXly happy, but might break if a library - // vendor decides to get creative + // this snippet of code assumes that time_t == seconds since Jan-1-1970 this + // is generally true and POSIXly happy, but might break if a library vendor + // decides to get creative time_t epoch = GetOSXEpoch(); epoch = epoch + (time_t)date_value; tm *tm_date = gmtime(&epoch); Index: lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp +++ lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp @@ -177,12 +177,11 @@ private: // the child here can be "real" (i.e. an actual child of the root) or - // synthetized from raw memory - // if the former, I need to store a plain pointer to it - or else a loop of - // references will cause this entire hierarchy of values to leak - // if the latter, then I need to store a SharedPointer to it - so that it only - // goes away when everyone else in the cluster goes away - // oh joy! + // synthetized from raw memory if the former, I need to store a plain pointer + // to it - or else a loop of references will cause this entire hierarchy of + // values to leak if the latter, then I need to store a SharedPointer to it - + // so that it only goes away when everyone else in the cluster goes away oh + // joy! ValueObject *m_child_ptr; ValueObjectSP m_child_sp; }; Index: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp +++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp @@ -171,12 +171,11 @@ private: // the child here can be "real" (i.e. an actual child of the root) or - // synthetized from raw memory - // if the former, I need to store a plain pointer to it - or else a loop of - // references will cause this entire hierarchy of values to leak - // if the latter, then I need to store a SharedPointer to it - so that it only - // goes away when everyone else in the cluster goes away - // oh joy! + // synthetized from raw memory if the former, I need to store a plain pointer + // to it - or else a loop of references will cause this entire hierarchy of + // values to leak if the latter, then I need to store a SharedPointer to it - + // so that it only goes away when everyone else in the cluster goes away oh + // joy! ValueObject *m_child_ptr; ValueObjectSP m_child_sp; }; Index: lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp +++ lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp @@ -256,8 +256,7 @@ uint64_t location = valobj_addr + 2 * ptr_size; if (!has_explicit_length) { // in this kind of string, the byte before the string content is a length - // byte - // so let's try and use it to handle the embedded NUL case + // byte so let's try and use it to handle the embedded NUL case Status error; explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error); @@ -368,9 +367,7 @@ } // this is a fairly ugly trick - pretend that the numeric value is actually a - // char* - // this works under a few assumptions: - // little endian architecture + // char* this works under a few assumptions: little endian architecture // sizeof(uint64_t) > g_MaxNonBitmaskedLen if (len_bits <= g_MaxNonBitmaskedLen) { stream.Printf("%s", prefix.c_str()); Index: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp =================================================================== --- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp @@ -90,9 +90,8 @@ if (name.empty()) return IsValid(strict); - // If "strict" is true. then the method must be specified with a - // '+' or '-' at the beginning. If "strict" is false, then the '+' - // or '-' can be omitted + // If "strict" is true. then the method must be specified with a '+' or '-' + // at the beginning. If "strict" is false, then the '+' or '-' can be omitted bool valid_prefix = false; if (name.size() > 1 && (name[0] == '+' || name[0] == '-')) { @@ -134,8 +133,8 @@ if (paren_pos) { m_class.SetCStringWithLength(class_start, paren_pos - class_start); } else { - // No '(' was found in the full name, we can definitively say - // that our category was valid (and empty). + // No '(' was found in the full name, we can definitively say that our + // category was valid (and empty). m_category_is_valid = true; const char *space_pos = strchr(full, ' '); if (space_pos) { @@ -164,8 +163,8 @@ // contain a '(', then we can also fill in the m_class if (!m_class && strchr(m_class_category.GetCString(), '(') == nullptr) { m_class = m_class_category; - // No '(' was found in the full name, we can definitively say - // that our category was valid (and empty). + // No '(' was found in the full name, we can definitively say that + // our category was valid (and empty). m_category_is_valid = true; } } @@ -796,8 +795,8 @@ objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags); - // CFAbsoluteTime is actually a double rather than a pointer to an object - // we do not care about the numeric value, since it is probably meaningless to + // CFAbsoluteTime is actually a double rather than a pointer to an object we + // do not care about the numeric value, since it is probably meaningless to // users appkit_flags.SetDontShowValue(true); AddCXXSummary(objc_category_sp, Index: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -93,8 +93,8 @@ TypeList class_types; uint32_t num_matches = 0; - // First look in the module that the vtable symbol came from - // and look for a single exact match. + // First look in the module that the vtable symbol came from and + // look for a single exact match. llvm::DenseSet searched_symbol_files; if (sc.module_sp) { num_matches = sc.module_sp->FindTypes( @@ -102,9 +102,8 @@ searched_symbol_files, class_types); } - // If we didn't find a symbol, then move on to the entire - // module list in the target and get as many unique matches - // as possible + // If we didn't find a symbol, then move on to the entire module + // list in the target and get as many unique matches as possible if (num_matches == 0) { num_matches = target.GetImages().FindTypes( sc, ConstString(lookup_name), exact_match, UINT32_MAX, @@ -192,15 +191,12 @@ TypeAndOrName &class_type_or_name, Address &dynamic_address, Value::ValueType &value_type) { // For Itanium, if the type has a vtable pointer in the object, it will be at - // offset 0 - // in the object. That will point to the "address point" within the vtable - // (not the beginning of the - // vtable.) We can then look up the symbol containing this "address point" - // and that symbol's name - // demangled will contain the full class name. - // The second pointer above the "address point" is the "offset_to_top". We'll - // use that to get the - // start of the value object which holds the dynamic type. + // offset 0 in the object. That will point to the "address point" within the + // vtable (not the beginning of the vtable.) We can then look up the symbol + // containing this "address point" and that symbol's name demangled will + // contain the full class name. The second pointer above the "address point" + // is the "offset_to_top". We'll use that to get the start of the value + // object which holds the dynamic type. // class_type_or_name.Clear(); @@ -235,17 +231,15 @@ if (class_type_or_name) { TypeSP type_sp = class_type_or_name.GetTypeSP(); - // There can only be one type with a given name, - // so we've just found duplicate definitions, and this - // one will do as well as any other. - // We don't consider something to have a dynamic type if - // it is the same as the static type. So compare against - // the value we were handed. + // There can only be one type with a given name, so we've just found + // duplicate definitions, and this one will do as well as any other. We + // don't consider something to have a dynamic type if it is the same as + // the static type. So compare against the value we were handed. if (type_sp) { if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(), type_sp->GetForwardCompilerType())) { - // The dynamic type we found was the same type, - // so we don't have a dynamic type here... + // The dynamic type we found was the same type, so we don't have a + // dynamic type here... return false; } @@ -262,8 +256,8 @@ if (offset_to_top == INT64_MIN) return false; - // So the dynamic type is a value that starts at offset_to_top - // above the original address. + // So the dynamic type is a value that starts at offset_to_top above + // the original address. lldb::addr_t dynamic_addr = original_ptr + offset_to_top; if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress( dynamic_addr, dynamic_address)) { @@ -285,10 +279,9 @@ TypeAndOrName ret(type_and_or_name); if (type_and_or_name.HasType()) { // The type will always be the type of the dynamic object. If our parent's - // type was a pointer, - // then our type should be a pointer to the type of the dynamic object. If - // a reference, then the original type - // should be okay... + // type was a pointer, then our type should be a pointer to the type of the + // dynamic object. If a reference, then the original type should be + // okay... CompilerType orig_type = type_and_or_name.GetCompilerType(); CompilerType corrected_type = orig_type; if (static_type_flags.AllSet(eTypeIsPointer)) @@ -373,8 +366,8 @@ // the actual Mangled class should be strict about this, but on the // command line if you're copying mangled names out of 'nm' on Darwin, - // they will come out with an extra underscore - be willing to strip - // this on behalf of the user. This is the moral equivalent of the -_/-n + // they will come out with an extra underscore - be willing to strip this + // on behalf of the user. This is the moral equivalent of the -_/-n // options to c++filt auto name = entry.ref; if (name.startswith("__Z")) @@ -453,13 +446,12 @@ BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver( Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions) { // One complication here is that most users DON'T want to stop at - // __cxa_allocate_expression, but until we can do - // anything better with predicting unwinding the expression parser does. So - // we have two forms of the exception - // breakpoints, one for expressions that leaves out __cxa_allocate_exception, - // and one that includes it. - // The SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint - // in the runtime the former. + // __cxa_allocate_expression, but until we can do anything better with + // predicting unwinding the expression parser does. So we have two forms of + // the exception breakpoints, one for expressions that leaves out + // __cxa_allocate_exception, and one that includes it. The + // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in + // the runtime the former. static const char *g_catch_name = "__cxa_begin_catch"; static const char *g_throw_name1 = "__cxa_throw"; static const char *g_throw_name2 = "__cxa_rethrow"; @@ -522,8 +514,7 @@ const bool for_expressions = true; // For the exception breakpoints set by the Expression parser, we'll be a - // little more aggressive and - // stop at exception allocation as well. + // little more aggressive and stop at exception allocation as well. if (m_cxx_exception_bp_sp) { m_cxx_exception_bp_sp->SetEnabled(true); Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -378,8 +378,7 @@ AppleObjCRuntime::ClassDescriptorSP metaclass(GetMetaclass()); // We don't care about the metaclass's superclass, or its class methods. - // Its instance methods are - // our class methods. + // Its instance methods are our class methods. if (metaclass) { metaclass->Describe( Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -54,23 +54,20 @@ CompilerType compiler_type(valobj.GetCompilerType()); bool is_signed; // ObjC objects can only be pointers (or numbers that actually represents - // pointers - // but haven't been typecast, because reasons..) + // pointers but haven't been typecast, because reasons..) if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType()) return false; - // Make the argument list: we pass one arg, the address of our pointer, to the - // print function. + // Make the argument list: we pass one arg, the address of our pointer, to + // the print function. Value val; if (!valobj.ResolveValue(val.GetScalar())) return false; // Value Objects may not have a process in their ExecutionContextRef. But we - // need to have one - // in the ref we pass down to eventually call description. Get it from the - // target if it isn't - // present. + // need to have one in the ref we pass down to eventually call description. + // Get it from the target if it isn't present. ExecutionContext exe_ctx; if (valobj.GetProcessSP()) { exe_ctx = ExecutionContext(valobj.GetExecutionContextRef()); @@ -257,10 +254,9 @@ TypeAndOrName ret(type_and_or_name); if (type_and_or_name.HasType()) { // The type will always be the type of the dynamic object. If our parent's - // type was a pointer, - // then our type should be a pointer to the type of the dynamic object. If - // a reference, then the original type - // should be okay... + // type was a pointer, then our type should be a pointer to the type of the + // dynamic object. If a reference, then the original type should be + // okay... CompilerType orig_type = type_and_or_name.GetCompilerType(); CompilerType corrected_type = orig_type; if (static_type_flags.AllSet(eTypeIsPointer)) @@ -325,8 +321,8 @@ bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) { // Maybe check here and if we have a handler already, and the UUID of this - // module is the same as the one in the - // current module, then we don't have to reread it? + // module is the same as the one in the current module, then we don't have to + // reread it? m_objc_trampoline_handler_ap.reset( new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp)); if (m_objc_trampoline_handler_ap.get() != NULL) { @@ -365,11 +361,9 @@ for (size_t i = 0; i < num_images; i++) { ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i); // One tricky bit here is that we might get called as part of the initial - // module loading, but - // before all the pre-run libraries get winnowed from the module list. So - // there might actually - // be an old and incorrect ObjC library sitting around in the list, and we - // don't want to look at that. + // module loading, but before all the pre-run libraries get winnowed from + // the module list. So there might actually be an old and incorrect ObjC + // library sitting around in the list, and we don't want to look at that. // That's why we call IsLoadedInTarget. if (AppleIsModuleObjCLibrary(module_sp) && Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -42,8 +42,7 @@ m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS) {} // for V1 runtime we just try to return a class name as that is the minimum -// level of support -// required for the data formatters to work +// level of support required for the data formatters to work bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress( ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, @@ -383,8 +382,8 @@ ObjCISA isa; if (bucket_isa_count == 1) { - // When we only have one entry in the bucket, the bucket data is - // the "isa" + // When we only have one entry in the bucket, the bucket data + // is the "isa" isa = bucket_data; if (isa) { if (!ISAIsCached(isa)) { @@ -402,8 +401,7 @@ } } else { // When we have more than one entry in the bucket, the bucket - // data is a pointer - // to an array of "isa" values + // data is a pointer to an array of "isa" values addr_t isa_addr = bucket_data; for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count; ++isa_idx, isa_addr += addr_size) { Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -77,8 +77,7 @@ static const char *g_get_dynamic_class_info_name = "__lldb_apple_objc_v2_get_dynamic_class_info"; // Testing using the new C++11 raw string literals. If this breaks GCC then we -// will -// need to revert to the code above... +// will need to revert to the code above... static const char *g_get_dynamic_class_info_body = R"( extern "C" @@ -162,8 +161,7 @@ static const char *g_get_shared_cache_class_info_name = "__lldb_apple_objc_v2_get_shared_cache_class_info"; // Testing using the new C++11 raw string literals. If this breaks GCC then we -// will -// need to revert to the code above... +// will need to revert to the code above... static const char *g_get_shared_cache_class_info_body = R"( extern "C" @@ -407,10 +405,9 @@ assert(m_process != NULL); // The Runtime is attached to a particular process, you shouldn't pass in a - // value from another process. - // Note, however, the process might be NULL (e.g. if the value was made with - // SBTarget::EvaluateExpression...) - // in which case it is sufficient if the target's match: + // value from another process. Note, however, the process might be NULL (e.g. + // if the value was made with SBTarget::EvaluateExpression...) in which case + // it is sufficient if the target's match: Process *process = in_value.GetProcessSP().get(); if (process) @@ -423,8 +420,8 @@ // Make sure we can have a dynamic value before starting... if (CouldHaveDynamicValue(in_value)) { - // First job, pull out the address at 0 offset from the object That will be - // the ISA pointer. + // First job, pull out the address at 0 offset from the object That will + // be the ISA pointer. ClassDescriptorSP objc_class_sp(GetNonKVOClassDescriptor(in_value)); if (objc_class_sp) { const addr_t object_ptr = in_value.GetPointerValue(); @@ -871,8 +868,8 @@ const char *class_name = parent_ast_type.GetConstTypeName().AsCString(); if (class_name && class_name[0] && ivar_name && ivar_name[0]) { //---------------------------------------------------------------------- - // Make the objective C V2 mangled name for the ivar offset from the - // class name and ivar name + // Make the objective C V2 mangled name for the ivar offset from the class + // name and ivar name //---------------------------------------------------------------------- std::string buffer("OBJC_IVAR_$_"); buffer.append(class_name); @@ -881,8 +878,8 @@ ConstString ivar_const_str(buffer.c_str()); //---------------------------------------------------------------------- - // Try to get the ivar offset address from the symbol table first using - // the name we created above + // Try to get the ivar offset address from the symbol table first using the + // name we created above //---------------------------------------------------------------------- SymbolContextList sc_list; Target &target = m_process->GetTarget(); @@ -915,11 +912,9 @@ } // tagged pointers are special not-a-real-pointer values that contain both type -// and value information -// this routine attempts to check with as little computational effort as -// possible whether something -// could possibly be a tagged pointer - false positives are possible but false -// negatives shouldn't +// and value information this routine attempts to check with as little +// computational effort as possible whether something could possibly be a +// tagged pointer - false positives are possible but false negatives shouldn't bool AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr) { if (!m_tagged_pointer_vendor_ap) return false; @@ -951,11 +946,11 @@ Status err; // This currently holds true for all platforms we support, but we might - // need to change this to use get the actually byte size of "unsigned" - // from the target AST... + // need to change this to use get the actually byte size of "unsigned" from + // the target AST... const uint32_t unsigned_byte_size = sizeof(uint32_t); - // Skip the prototype as we don't need it (const struct +NXMapTablePrototype - // *prototype) + // Skip the prototype as we don't need it (const struct + // +NXMapTablePrototype *prototype) bool success = true; if (load_addr == LLDB_INVALID_ADDRESS) @@ -989,8 +984,8 @@ return success; } - // const_iterator mimics NXMapState and its code comes from NXInitMapState and - // NXNextMapState. + // const_iterator mimics NXMapState and its code comes from NXInitMapState + // and NXNextMapState. typedef std::pair element; friend class const_iterator; @@ -1133,8 +1128,8 @@ return false; // Failed to parse the header, no need to update anything } - // Check with out current signature and return true if the count, - // number of buckets or the hash table address changes. + // Check with out current signature and return true if the count, number of + // buckets or the hash table address changes. if (m_count == hash_table.GetCount() && m_num_buckets == hash_table.GetBucketCount() && m_buckets_ptr == hash_table.GetBucketDataPointer()) { @@ -1168,9 +1163,9 @@ } return nullptr; } - // if we get an invalid VO (which might still happen when playing around - // with pointers returned by the expression parser, don't consider this - // a valid ObjC object) + // if we get an invalid VO (which might still happen when playing around with + // pointers returned by the expression parser, don't consider this a valid + // ObjC object) if (valobj.GetCompilerType().IsValid()) { addr_t isa_pointer = valobj.GetPointerValue(); @@ -1360,8 +1355,8 @@ arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr; arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size; - // Only dump the runtime classes from the expression evaluation if the - // log is verbose: + // Only dump the runtime classes from the expression evaluation if the log is + // verbose: Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); bool dump_log = type_log && type_log->GetVerbose(); @@ -1455,8 +1450,8 @@ "AppleObjCRuntimeV2 found NULL isa, ignoring this class info"); continue; } - // Check if we already know about this ISA, if we do, the info will - // never change, so we can just skip it. + // Check if we already know about this ISA, if we do, the info will never + // change, so we can just skip it. if (ISAIsCached(isa)) { if (log) log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64 @@ -1607,8 +1602,8 @@ arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr; arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr; arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size; - // Only dump the runtime classes from the expression evaluation if the - // log is verbose: + // Only dump the runtime classes from the expression evaluation if the log is + // verbose: Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES); bool dump_log = type_log && type_log->GetVerbose(); @@ -1788,21 +1783,17 @@ DescriptorMapUpdateResult dynamic_update_result = UpdateISAToDescriptorMapDynamic(hash_table); - // Now get the objc classes that are baked into the Objective C runtime - // in the shared cache, but only once per process as this data never - // changes + // Now get the objc classes that are baked into the Objective C runtime in + // the shared cache, but only once per process as this data never changes if (!m_loaded_objc_opt) { // it is legitimately possible for the shared cache to be empty - in that - // case, the dynamic hash table - // will contain all the class information we need; the situation we're - // trying to detect is one where - // we aren't seeing class information from the runtime - in order to - // detect that vs. just the shared cache - // being empty or sparsely populated, we set an arbitrary (very low) - // threshold for the number of classes - // that we want to see in a "good" scenario - anything below that is - // suspicious (Foundation alone has thousands - // of classes) + // case, the dynamic hash table will contain all the class information we + // need; the situation we're trying to detect is one where we aren't + // seeing class information from the runtime - in order to detect that + // vs. just the shared cache being empty or sparsely populated, we set an + // arbitrary (very low) threshold for the number of classes that we want + // to see in a "good" scenario - anything below that is suspicious + // (Foundation alone has thousands of classes) const uint32_t num_classes_to_warn_at = 500; DescriptorMapUpdateResult shared_cache_update_result = @@ -2089,8 +2080,8 @@ if (error.Fail()) return new TaggedPointerVendorLegacy(runtime); - // try to detect the "extended tagged pointer" variables - if any are missing, - // use the non-extended vendor + // try to detect the "extended tagged pointer" variables - if any are + // missing, use the non-extended vendor do { auto objc_debug_taggedpointer_ext_mask = ExtractRuntimeGlobalSymbol( process, ConstString("objc_debug_taggedpointer_ext_mask"), @@ -2143,8 +2134,8 @@ objc_debug_taggedpointer_classes, objc_debug_taggedpointer_ext_classes); } while (false); - // we might want to have some rules to outlaw these values (e.g if the table's - // address is zero) + // we might want to have some rules to outlaw these values (e.g if the + // table's address is zero) return new TaggedPointerVendorRuntimeAssisted( runtime, objc_debug_taggedpointer_mask, @@ -2414,11 +2405,10 @@ if ((isa & ~m_objc_debug_isa_class_mask) == 0) return false; - // If all of the indexed ISA variables are set, then its possible that - // this ISA is indexed, and we should first try to get its value using - // the index. - // Note, we check these varaibles first as the ObjC runtime will set at - // least one of their values to 0 if they aren't needed. + // If all of the indexed ISA variables are set, then its possible that this + // ISA is indexed, and we should first try to get its value using the index. + // Note, we check these varaibles first as the ObjC runtime will set at least + // one of their values to 0 if they aren't needed. if (m_objc_debug_indexed_isa_magic_mask && m_objc_debug_indexed_isa_magic_value && m_objc_debug_indexed_isa_index_mask && @@ -2431,10 +2421,10 @@ // Magic bits are correct, so try extract the index. uintptr_t index = (isa & m_objc_debug_indexed_isa_index_mask) >> m_objc_debug_indexed_isa_index_shift; - // If the index is out of bounds of the length of the array then - // check if the array has been updated. If that is the case then - // we should try read the count again, and update the cache if the - // count has been updated. + // If the index is out of bounds of the length of the array then check if + // the array has been updated. If that is the case then we should try + // read the count again, and update the cache if the count has been + // updated. if (index > m_indexed_isa_cache.size()) { if (log) log->Printf("AOCRT::NPI (index = %" PRIu64 @@ -2459,9 +2449,9 @@ (uint64_t)objc_indexed_classes_count); if (objc_indexed_classes_count > m_indexed_isa_cache.size()) { - // Read the class entries we don't have. We should just - // read all of them instead of just the one we need as then - // we can cache those we may need later. + // Read the class entries we don't have. We should just read all of + // them instead of just the one we need as then we can cache those we + // may need later. auto num_new_classes = objc_indexed_classes_count - m_indexed_isa_cache.size(); const uint32_t addr_size = process->GetAddressByteSize(); @@ -2504,8 +2494,8 @@ return false; } - // Definately not an indexed ISA, so try to use a mask to extract - // the pointer from the ISA. + // Definately not an indexed ISA, so try to use a mask to extract the pointer + // from the ISA. if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) { ret_isa = isa & m_objc_debug_isa_class_mask; return (ret_isa != 0); // this is a pointer so 0 is not a valid value Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -49,227 +49,237 @@ const char *AppleObjCTrampolineHandler:: g_lookup_implementation_with_stret_function_code = " \n\ -extern \"C\" \n\ -{ \n\ - extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\ - extern void *class_getMethodImplementation_stret(void *objc_class, void *sel); \n\ - extern void * object_getClass (id object); \n\ - extern void * sel_getUid(char *name); \n\ - extern int printf(const char *format, ...); \n\ -} \n\ -extern \"C\" void * __lldb_objc_find_implementation_for_selector (void *object, \n\ - void *sel, \n\ - int is_stret, \n\ - int is_super, \n\ - int is_super2, \n\ - int is_fixup, \n\ - int is_fixed, \n\ - int debug) \n\ -{ \n\ - struct __lldb_imp_return_struct \n\ - { \n\ - void *class_addr; \n\ - void *sel_addr; \n\ - void *impl_addr; \n\ - }; \n\ - \n\ - struct __lldb_objc_class { \n\ - void *isa; \n\ - void *super_ptr; \n\ - }; \n\ - struct __lldb_objc_super { \n\ - void *reciever; \n\ - struct __lldb_objc_class *class_ptr; \n\ - }; \n\ - struct __lldb_msg_ref { \n\ - void *dont_know; \n\ - void *sel; \n\ - }; \n\ - \n\ - struct __lldb_imp_return_struct return_struct; \n\ - \n\ - if (debug) \n\ - printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \" \n\ - \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\ - object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed); \n\ - if (is_super) \n\ - { \n\ - if (is_super2) \n\ - { \n\ - return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr; \n\ - } \n\ - else \n\ - { \n\ - return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr; \n\ - } \n\ - } \n\ - else \n\ - { \n\ - // This code seems a little funny, but has its reasons... \n\ - // The call to [object class] is here because if this is a class, and has not been called into \n\ - // yet, we need to do something to force the class to initialize itself. \n\ - // Then the call to object_getClass will actually return the correct class, either the class \n\ - // if object is a class instance, or the meta-class if it is a class pointer. \n\ - void *class_ptr = (void *) [(id) object class]; \n\ - return_struct.class_addr = (id) object_getClass((id) object); \n\ - if (debug) \n\ - { \n\ - if (class_ptr == object) \n\ - { \n\ - printf (\"Found a class object, need to use the meta class %p -> %p\\n\", \n\ - class_ptr, return_struct.class_addr); \n\ - } \n\ - else \n\ - { \n\ - printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\ - class_ptr, return_struct.class_addr); \n\ - } \n\ - } \n\ - } \n\ - \n\ - if (is_fixup) \n\ - { \n\ - if (is_fixed) \n\ - { \n\ - return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\ - } \n\ - else \n\ - { \n\ - char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\ - return_struct.sel_addr = sel_getUid (sel_name); \n\ - if (debug) \n\ - printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\", \n\ - return_struct.sel_addr, sel_name); \n\ - } \n\ - } \n\ - else \n\ - { \n\ - return_struct.sel_addr = sel; \n\ - } \n\ - \n\ - if (is_stret) \n\ - { \n\ - return_struct.impl_addr = class_getMethodImplementation_stret (return_struct.class_addr, \n\ - return_struct.sel_addr); \n\ - } \n\ - else \n\ - { \n\ - return_struct.impl_addr = class_getMethodImplementation (return_struct.class_addr, \n\ - return_struct.sel_addr); \n\ - } \n\ - if (debug) \n\ - printf (\"\\n*** Returning implementation: %p.\\n\", return_struct.impl_addr); \n\ - \n\ - return return_struct.impl_addr; \n\ -} \n\ +extern \"C\" \n\ +{ \n\ + extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\ + extern void *class_getMethodImplementation_stret(void *objc_class, \n\ + void *sel); \n\ + extern void * object_getClass (id object); \n\ + extern void * sel_getUid(char *name); \n\ + extern int printf(const char *format, ...); \n\ +} \n\ +extern \"C\" void * __lldb_objc_find_implementation_for_selector ( \n\ + void *object, \n\ + void *sel, \n\ + int is_stret, \n\ + int is_super, \n\ + int is_super2, \n\ + int is_fixup, \n\ + int is_fixed, \n\ + int debug) \n\ +{ \n\ + struct __lldb_imp_return_struct \n\ + { \n\ + void *class_addr; \n\ + void *sel_addr; \n\ + void *impl_addr; \n\ + }; \n\ + \n\ + struct __lldb_objc_class { \n\ + void *isa; \n\ + void *super_ptr; \n\ + }; \n\ + struct __lldb_objc_super { \n\ + void *reciever; \n\ + struct __lldb_objc_class *class_ptr; \n\ + }; \n\ + struct __lldb_msg_ref { \n\ + void *dont_know; \n\ + void *sel; \n\ + }; \n\ + \n\ + struct __lldb_imp_return_struct return_struct; \n\ + \n\ + if (debug) \n\ + printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \"\n\ + \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\ + object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed);\n\ + if (is_super) \n\ + { \n\ + if (is_super2) \n\ + { \n\ + return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr;\n\ + } \n\ + else \n\ + { \n\ + return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr;\n\ + } \n\ + } \n\ + else \n\ + { \n\ + // This code seems a little funny, but has its reasons... \n\ + \n\ + // The call to [object class] is here because if this is a \n\ + // class, and has not been called into yet, we need to do \n\ + // something to force the class to initialize itself. \n\ + // Then the call to object_getClass will actually return the \n\ + // correct class, either the class if object is a class \n\ + // instance, or the meta-class if it is a class pointer. \n\ + void *class_ptr = (void *) [(id) object class]; \n\ + return_struct.class_addr = (id) object_getClass((id) object); \n\ + if (debug) \n\ + { \n\ + if (class_ptr == object) \n\ + { \n\ + printf (\"Found a class object, need to use the meta class %p -> %p\\n\",\n\ + class_ptr, return_struct.class_addr); \n\ + } \n\ + else \n\ + { \n\ + printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\ + class_ptr, return_struct.class_addr); \n\ + } \n\ + } \n\ + } \n\ + \n\ + if (is_fixup) \n\ + { \n\ + if (is_fixed) \n\ + { \n\ + return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\ + } \n\ + else \n\ + { \n\ + char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\ + return_struct.sel_addr = sel_getUid (sel_name); \n\ + if (debug) \n\ + printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\",\n\ + return_struct.sel_addr, sel_name); \n\ + } \n\ + } \n\ + else \n\ + { \n\ + return_struct.sel_addr = sel; \n\ + } \n\ + \n\ + if (is_stret) \n\ + { \n\ + return_struct.impl_addr = \n\ + class_getMethodImplementation_stret (return_struct.class_addr, \n\ + return_struct.sel_addr); \n\ + } \n\ + else \n\ + { \n\ + return_struct.impl_addr = \n\ + class_getMethodImplementation (return_struct.class_addr, \n\ + return_struct.sel_addr); \n\ + } \n\ + if (debug) \n\ + printf (\"\\n*** Returning implementation: %p.\\n\", \n\ + return_struct.impl_addr); \n\ + \n\ + return return_struct.impl_addr; \n\ +} \n\ "; const char * AppleObjCTrampolineHandler::g_lookup_implementation_no_stret_function_code = " \n\ -extern \"C\" \n\ -{ \n\ - extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\ - extern void * object_getClass (id object); \n\ - extern void * sel_getUid(char *name); \n\ - extern int printf(const char *format, ...); \n\ -} \n\ +extern \"C\" \n\ +{ \n\ + extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\ + extern void * object_getClass (id object); \n\ + extern void * sel_getUid(char *name); \n\ + extern int printf(const char *format, ...); \n\ +} \n\ extern \"C\" void * __lldb_objc_find_implementation_for_selector (void *object, \n\ - void *sel, \n\ - int is_stret, \n\ - int is_super, \n\ - int is_super2, \n\ - int is_fixup, \n\ - int is_fixed, \n\ - int debug) \n\ -{ \n\ - struct __lldb_imp_return_struct \n\ - { \n\ - void *class_addr; \n\ - void *sel_addr; \n\ - void *impl_addr; \n\ - }; \n\ - \n\ - struct __lldb_objc_class { \n\ - void *isa; \n\ - void *super_ptr; \n\ - }; \n\ - struct __lldb_objc_super { \n\ - void *reciever; \n\ - struct __lldb_objc_class *class_ptr; \n\ - }; \n\ - struct __lldb_msg_ref { \n\ - void *dont_know; \n\ - void *sel; \n\ - }; \n\ - \n\ - struct __lldb_imp_return_struct return_struct; \n\ - \n\ - if (debug) \n\ + void *sel, \n\ + int is_stret, \n\ + int is_super, \n\ + int is_super2, \n\ + int is_fixup, \n\ + int is_fixed, \n\ + int debug) \n\ +{ \n\ + struct __lldb_imp_return_struct \n\ + { \n\ + void *class_addr; \n\ + void *sel_addr; \n\ + void *impl_addr; \n\ + }; \n\ + \n\ + struct __lldb_objc_class { \n\ + void *isa; \n\ + void *super_ptr; \n\ + }; \n\ + struct __lldb_objc_super { \n\ + void *reciever; \n\ + struct __lldb_objc_class *class_ptr; \n\ + }; \n\ + struct __lldb_msg_ref { \n\ + void *dont_know; \n\ + void *sel; \n\ + }; \n\ + \n\ + struct __lldb_imp_return_struct return_struct; \n\ + \n\ + if (debug) \n\ printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \" \n\ - \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\ + \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\ object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed); \n\ - if (is_super) \n\ - { \n\ - if (is_super2) \n\ - { \n\ + if (is_super) \n\ + { \n\ + if (is_super2) \n\ + { \n\ return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr; \n\ - } \n\ - else \n\ - { \n\ + } \n\ + else \n\ + { \n\ return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr; \n\ - } \n\ - } \n\ - else \n\ - { \n\ - // This code seems a little funny, but has its reasons... \n\ + } \n\ + } \n\ + else \n\ + { \n\ + // This code seems a little funny, but has its reasons... \n\ // The call to [object class] is here because if this is a class, and has not been called into \n\ // yet, we need to do something to force the class to initialize itself. \n\ // Then the call to object_getClass will actually return the correct class, either the class \n\ // if object is a class instance, or the meta-class if it is a class pointer. \n\ - void *class_ptr = (void *) [(id) object class]; \n\ - return_struct.class_addr = (id) object_getClass((id) object); \n\ - if (debug) \n\ - { \n\ - if (class_ptr == object) \n\ - { \n\ + void *class_ptr = (void *) [(id) object class]; \n\ + return_struct.class_addr = (id) object_getClass((id) object); \n\ + if (debug) \n\ + { \n\ + if (class_ptr == object) \n\ + { \n\ printf (\"Found a class object, need to return the meta class %p -> %p\\n\", \n\ - class_ptr, return_struct.class_addr); \n\ - } \n\ - else \n\ - { \n\ + class_ptr, return_struct.class_addr); \n\ + } \n\ + else \n\ + { \n\ printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\ - class_ptr, return_struct.class_addr); \n\ - } \n\ - } \n\ - } \n\ - \n\ - if (is_fixup) \n\ - { \n\ - if (is_fixed) \n\ - { \n\ - return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\ - } \n\ - else \n\ - { \n\ - char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\ - return_struct.sel_addr = sel_getUid (sel_name); \n\ - if (debug) \n\ - printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\", \n\ - return_struct.sel_addr, sel_name); \n\ - } \n\ - } \n\ - else \n\ - { \n\ - return_struct.sel_addr = sel; \n\ - } \n\ - \n\ - return_struct.impl_addr = class_getMethodImplementation (return_struct.class_addr, \n\ - return_struct.sel_addr); \n\ - if (debug) \n\ - printf (\"\\n*** Returning implementation: 0x%p.\\n\", return_struct.impl_addr); \n\ - \n\ - return return_struct.impl_addr; \n\ -} \n\ + class_ptr, return_struct.class_addr); \n\ + } \n\ + } \n\ + } \n\ + \n\ + if (is_fixup) \n\ + { \n\ + if (is_fixed) \n\ + { \n\ + return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\ + } \n\ + else \n\ + { \n\ + char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\ + return_struct.sel_addr = sel_getUid (sel_name); \n\ + if (debug) \n\ + printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\",\n\ + return_struct.sel_addr, sel_name); \n\ + } \n\ + } \n\ + else \n\ + { \n\ + return_struct.sel_addr = sel; \n\ + } \n\ + \n\ + return_struct.impl_addr = \n\ + class_getMethodImplementation (return_struct.class_addr, \n\ + return_struct.sel_addr); \n\ + if (debug) \n\ + printf (\"\\n*** Returning implementation: 0x%p.\\n\", \n\ + return_struct.impl_addr); \n\ + \n\ + return return_struct.impl_addr; \n\ +} \n\ "; AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion( @@ -328,12 +338,11 @@ // uint32_t offset // uint32_t flags // - // Where offset is either 0 - in which case it is unused, or - // it is the offset of the vtable code from the beginning of the descriptor - // record. - // Below, we'll convert that into an absolute code address, since I don't want - // to have - // to compute it over and over. + // Where offset is either 0 - in which case it is unused, or it is + // the offset of the vtable code from the beginning of the + // descriptor record. Below, we'll convert that into an absolute + // code address, since I don't want to have to compute it over and + // over. // Ingest the whole descriptor array: const lldb::addr_t desc_ptr = m_header_addr + header_size; @@ -370,10 +379,9 @@ offset = start_offset + descriptor_size; } - // Finally, a little bird told me that all the vtable code blocks are the same - // size. - // Let's compute the blocks and if they are all the same add the size to the - // code end address: + // Finally, a little bird told me that all the vtable code blocks + // are the same size. Let's compute the blocks and if they are all + // the same add the size to the code end address: lldb::addr_t code_size = 0; bool all_the_same = true; for (size_t i = 0; i < num_descriptors - 1; i++) { @@ -548,9 +556,8 @@ } bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions() { - // The no argument version reads the start region from the value of the - // gdb_regions_header, and - // gets started from there. + // The no argument version reads the start region from the value of + // the gdb_regions_header, and gets started from there. m_regions.clear(); if (!InitializeVTableSymbols()) @@ -718,13 +725,12 @@ g_lookup_implementation_with_stret_function_code; } - // Look up the addresses for the objc dispatch functions and cache them. For - // now I'm inspecting the symbol - // names dynamically to figure out how to dispatch to them. If it becomes - // more complicated than this we can - // turn the g_dispatch_functions char * array into a template table, and - // populate the DispatchFunction map - // from there. + // Look up the addresses for the objc dispatch functions and cache + // them. For now I'm inspecting the symbol names dynamically to + // figure out how to dispatch to them. If it becomes more + // complicated than this we can turn the g_dispatch_functions char * + // array into a template table, and populate the DispatchFunction + // map from there. for (size_t i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++) { ConstString name_const_str(g_dispatch_functions[i].name); @@ -732,11 +738,11 @@ m_objc_module_sp->FindFirstSymbolWithNameAndType(name_const_str, eSymbolTypeCode); if (msgSend_symbol && msgSend_symbol->ValueIsAddress()) { - // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and - // have the map be address->index. - // Problem is we also need to lookup the dispatch function. For now we - // could have a side table of stret & non-stret - // dispatch functions. If that's as complex as it gets, we're fine. + // FIXME: Make g_dispatch_functions static table of + // DispatchFunctions, and have the map be address->index. + // Problem is we also need to lookup the dispatch function. For + // now we could have a side table of stret & non-stret dispatch + // functions. If that's as complex as it gets, we're fine. lldb::addr_t sym_addr = msgSend_symbol->GetAddressRef().GetOpcodeLoadAddress(target); @@ -820,11 +826,11 @@ diagnostics.Clear(); - // Now write down the argument values for this particular call. This looks - // like it might be a race condition - // if other threads were calling into here, but actually it isn't because we - // allocate a new args structure for - // this call by passing args_addr = LLDB_INVALID_ADDRESS... + // Now write down the argument values for this particular call. + // This looks like it might be a race condition if other threads + // were calling into here, but actually it isn't because we allocate + // a new args structure for this call by passing args_addr = + // LLDB_INVALID_ADDRESS... if (!impl_function_caller->WriteFunctionArguments( exe_ctx, args_addr, dispatch_values, diagnostics)) { @@ -847,9 +853,9 @@ DispatchFunction this_dispatch; bool found_it = false; - // First step is to look and see if we are in one of the known ObjC dispatch - // functions. We've already compiled - // a table of same, so consult it. + // First step is to look and see if we are in one of the known ObjC + // dispatch functions. We've already compiled a table of same, so + // consult it. MsgsendMap::iterator pos; pos = m_msgSend_map.find(curr_pc); @@ -879,8 +885,8 @@ if (found_it) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - // We are decoding a method dispatch. - // First job is to pull the arguments out: + // We are decoding a method dispatch. First job is to pull the + // arguments out: lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0); @@ -906,10 +912,10 @@ int obj_index; int sel_index; - // If this is a struct return dispatch, then the first argument is the - // return struct pointer, and the object is the second, and the selector is - // the third. - // Otherwise the object is the first and the selector the second. + // If this is a struct return dispatch, then the first argument is + // the return struct pointer, and the object is the second, and + // the selector is the third. Otherwise the object is the first + // and the selector the second. if (this_dispatch.stret_return) { obj_index = 1; sel_index = 2; @@ -938,29 +944,26 @@ ExecutionContext exe_ctx(thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); - // isa_addr will store the class pointer that the method is being dispatched - // to - so either the class - // directly or the super class if this is one of the objc_msgSendSuper - // flavors. That's mostly used to - // look up the class/selector pair in our cache. + // isa_addr will store the class pointer that the method is being + // dispatched to - so either the class directly or the super class + // if this is one of the objc_msgSendSuper flavors. That's mostly + // used to look up the class/selector pair in our cache. lldb::addr_t isa_addr = LLDB_INVALID_ADDRESS; lldb::addr_t sel_addr = argument_values.GetValueAtIndex(sel_index)->GetScalar().ULongLong(); - // Figure out the class this is being dispatched to and see if we've already - // cached this method call, - // If so we can push a run-to-address plan directly. Otherwise we have to - // figure out where - // the implementation lives. + // Figure out the class this is being dispatched to and see if + // we've already cached this method call, If so we can push a + // run-to-address plan directly. Otherwise we have to figure out + // where the implementation lives. if (this_dispatch.is_super) { if (this_dispatch.is_super2) { - // In the objc_msgSendSuper2 case, we don't get the object directly, we - // get a structure containing - // the object and the class to which the super message is being sent. - // So we need to dig the super - // out of the class and use that. + // In the objc_msgSendSuper2 case, we don't get the object + // directly, we get a structure containing the object and the + // class to which the super message is being sent. So we need + // to dig the super out of the class and use that. Value super_value(*(argument_values.GetValueAtIndex(obj_index))); super_value.GetScalar() += process->GetAddressByteSize(); @@ -984,11 +987,11 @@ log->Printf("Failed to extract the class value from objc_super."); } } else { - // In the objc_msgSendSuper case, we don't get the object directly, we - // get a two element structure containing - // the object and the super class to which the super message is being - // sent. So the class we want is - // the second element of this structure. + // In the objc_msgSendSuper case, we don't get the object + // directly, we get a two element structure containing the + // object and the super class to which the super message is + // being sent. So the class we want is the second element of + // this structure. Value super_value(*(argument_values.GetValueAtIndex(obj_index))); super_value.GetScalar() += process->GetAddressByteSize(); @@ -1009,9 +1012,9 @@ // making the object value a load address value and resolving it will get // the pointer sized data pointed to by that value... - // Note, it isn't a fatal error not to be able to get the address from the - // object, since this might - // be a "tagged pointer" which isn't a real object, but rather some word + // Note, it isn't a fatal error not to be able to get the + // address from the object, since this might be a "tagged + // pointer" which isn't a real object, but rather some word // length encoded dingus. Value isa_value(*(argument_values.GetValueAtIndex(obj_index))); @@ -1126,9 +1129,9 @@ flag_value.GetScalar() = 0; // FIXME - Set to 0 when debugging is done. dispatch_values.PushValue(flag_value); - // The step through code might have to fill in the cache, so it is not - // safe to run only one thread. - // So we override the stop_others value passed in to us here: + // The step through code might have to fill in the cache, so it + // is not safe to run only one thread. So we override the + // stop_others value passed in to us here: const bool trampoline_stop_others = false; ret_plan_sp.reset(new AppleThreadPlanStepThroughObjCTrampoline( thread, this, dispatch_values, isa_addr, sel_addr, Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp @@ -105,10 +105,9 @@ return clang::QualType(); std::string name(ReadStructName(type)); - // We do not handle templated classes/structs at the moment. - // If the name has a < in it, we are going to abandon this. - // We're still obliged to parse it, so we just set a flag that - // means "Don't actually build anything." + // We do not handle templated classes/structs at the moment. If the name has + // a < in it, we are going to abandon this. We're still obliged to parse it, + // so we just set a flag that means "Don't actually build anything." const bool is_templated = name.find('<') != std::string::npos; @@ -180,11 +179,9 @@ // the runtime can emit these in the form of @"SomeType", giving more specifics // this would be interesting for expression parser interop, but since we -// actually try -// to avoid exposing the ivar info to the expression evaluator, consume but -// ignore the type info -// and always return an 'id'; if anything, dynamic typing will resolve things -// for us anyway +// actually try to avoid exposing the ivar info to the expression evaluator, +// consume but ignore the type info and always return an 'id'; if anything, +// dynamic typing will resolve things for us anyway clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType( clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type, bool for_expression) { @@ -197,24 +194,21 @@ // We have to be careful here. We're used to seeing // @"NSString" // but in records it is possible that the string following an @ is the name - // of the next field and @ means "id". - // This is the case if anything unquoted except for "}", the end of the - // type, or another name follows the quoted string. + // of the next field and @ means "id". This is the case if anything + // unquoted except for "}", the end of the type, or another name follows + // the quoted string. // // E.g. // - @"NSString"@ means "id, followed by a field named NSString of type id" - // - @"NSString"} means "a pointer to NSString and the end of the struct" - // - @"NSString""nextField" means "a pointer to NSString and a field named - // nextField" - // - @"NSString" followed by the end of the string means "a pointer to - // NSString" + // - @"NSString"} means "a pointer to NSString and the end of the struct" - + // @"NSString""nextField" means "a pointer to NSString and a field named + // nextField" - @"NSString" followed by the end of the string means "a + // pointer to NSString" // // As a result, the rule is: If we see @ followed by a quoted string, we - // peek. - // - If we see }, ), ], the end of the string, or a quote ("), the quoted - // string is a class name. - // - If we see anything else, the quoted string is a field name and we push - // it back onto type. + // peek. - If we see }, ), ], the end of the string, or a quote ("), the + // quoted string is a class name. - If we see anything else, the quoted + // string is a field name and we push it back onto type. name = ReadQuotedString(type); @@ -260,9 +254,8 @@ decl_vendor->FindDecls(ConstString(name), append, max_matches, decls); // The user can forward-declare something that has no definition. The runtime -// doesn't prohibit this at all. -// This is a rare and very weird case. We keep this assert in debug builds so -// we catch other weird cases. +// doesn't prohibit this at all. This is a rare and very weird case. We keep +// this assert in debug builds so we catch other weird cases. #ifdef LLDB_CONFIGURATION_DEBUG assert(num_types); #else @@ -315,8 +308,8 @@ // if (!lldb_ctx) // return clang::QualType(); // return lldb_ctx->GetIntTypeFromBitSize(32, true).GetQualType(); - // which uses one of the constants if one is available, but we don't think all - // this work is necessary. + // which uses one of the constants if one is available, but we don't think + // all this work is necessary. case 'q': return ast_ctx.LongLongTy; case 'C': @@ -364,11 +357,10 @@ case '^': { if (!for_expression && type.NextIf('?')) { // if we are not supporting the concept of unknownAny, but what is being - // created here is an unknownAny*, then - // we can just get away with a void* + // created here is an unknownAny*, then we can just get away with a void* // this is theoretically wrong (in the same sense as 'theoretically - // nothing exists') but is way better than outright failure - // in many practical cases + // nothing exists') but is way better than outright failure in many + // practical cases return ast_ctx.VoidPtrTy; } else { clang::QualType target_type = BuildType(ast_ctx, type, for_expression); Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp @@ -52,8 +52,8 @@ void AppleThreadPlanStepThroughObjCTrampoline::DidPush() { // Setting up the memory space for the called function text might require - // allocations, - // i.e. a nested function call. This needs to be done as a PreResumeAction. + // allocations, i.e. a nested function call. This needs to be done as a + // PreResumeAction. m_thread.GetProcess()->AddPreResumeAction(PreResumeInitializeFunctionCaller, (void *)this); } @@ -110,8 +110,7 @@ Event *event_ptr) { // If we get asked to explain the stop it will be because something went // wrong (like the implementation for selector function crashed... We're - // going - // to figure out what to do about that, so we do explain the stop. + // going to figure out what to do about that, so we do explain the stop. return true; } @@ -135,8 +134,7 @@ } // Second stage, if all went well with the function calling, then fetch the - // target address, and - // queue up a "run to that address" plan. + // target address, and queue up a "run to that address" plan. if (!m_run_to_sp) { Value target_addr_value; ExecutionContext exc_ctx; @@ -201,8 +199,8 @@ return false; } -// The base class MischiefManaged does some cleanup - so you have to call it -// in your MischiefManaged derived class. +// The base class MischiefManaged does some cleanup - so you have to call it in +// your MischiefManaged derived class. bool AppleThreadPlanStepThroughObjCTrampoline::MischiefManaged() { if (IsPlanComplete()) return true; Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -38,14 +38,12 @@ // [``slang``](https://android.googlesource.com/platform/frameworks/compile/slang), // the compiler frontend for RenderScript embeds an ARM specific triple in IR -// that is shipped in the app, after -// generating IR that has some assumptions that an ARM device is the target. -// As the IR is then compiled on a device of unknown (at time the IR was -// generated at least) architecture, -// when calling RenderScript API function as part of debugger expressions, we -// have to perform a fixup pass that -// removes those assumptions right before the module is sent to be generated by -// the llvm backend. +// that is shipped in the app, after generating IR that has some assumptions +// that an ARM device is the target. As the IR is then compiled on a device of +// unknown (at time the IR was generated at least) architecture, when calling +// RenderScript API function as part of debugger expressions, we have to +// perform a fixup pass that removes those assumptions right before the module +// is sent to be generated by the llvm backend. namespace { bool registerRSDefaultTargetOpts(clang::TargetOptions &proto, @@ -107,10 +105,9 @@ case llvm::Triple::ArchType::x86: changed_module |= fixupX86FunctionCalls(module); // For some reason this triple gets totally missed by the backend, and must - // be set manually. - // There a reference in bcc/Main.cpp about auto feature-detection being - // removed from LLVM3.5, but I can't - // see that discussion anywhere public. + // be set manually. There a reference in bcc/Main.cpp about auto feature- + // detection being removed from LLVM3.5, but I can't see that discussion + // anywhere public. real_triple = "i686--linux-android"; break; case llvm::Triple::ArchType::x86_64: @@ -118,12 +115,12 @@ break; case llvm::Triple::ArchType::mipsel: case llvm::Triple::ArchType::mips64el: - // No actual IR fixup pass is needed on MIPS, but the datalayout - // and targetmachine do need to be explicitly set. + // No actual IR fixup pass is needed on MIPS, but the datalayout and + // targetmachine do need to be explicitly set. - // bcc explicitly compiles MIPS code to use the static relocation - // model due to an issue with relocations in mclinker. - // see libbcc/support/CompilerConfig.cpp for details + // bcc explicitly compiles MIPS code to use the static relocation model due + // to an issue with relocations in mclinker. see + // libbcc/support/CompilerConfig.cpp for details reloc_model = llvm::Reloc::Static; changed_module = true; break; @@ -146,8 +143,7 @@ assert(target_machine && "failed to identify RenderScriptRuntime target machine"); // We've been using a triple and datalayout of some ARM variant all along, - // so - // we need to let the backend know that this is no longer the case. + // so we need to let the backend know that this is no longer the case. if (log) { log->Printf("%s - Changing RS target triple to '%s'", __FUNCTION__, real_triple.str().c_str()); Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -312,7 +312,8 @@ Status err; - // find offset to arguments on the stack (+16 to skip over a0-a3 shadow space) + // find offset to arguments on the stack (+16 to skip over a0-a3 shadow + // space) uint64_t sp = ctx.reg_ctx->GetSP() + 16; for (size_t i = 0; i < num_args; ++i) { @@ -447,12 +448,11 @@ } bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) { - // takes an argument of the form 'num[,num][,num]'. - // Where 'coord_s' is a comma separated 1,2 or 3-dimensional coordinate - // with the whitespace trimmed. - // Missing coordinates are defaulted to zero. - // If parsing of any elements fails the contents of &coord are undefined - // and `false` is returned, `true` otherwise + // takes an argument of the form 'num[,num][,num]'. Where 'coord_s' is a + // comma separated 1,2 or 3-dimensional coordinate with the whitespace + // trimmed. Missing coordinates are defaulted to zero. If parsing of any + // elements fails the contents of &coord are undefined and `false` is + // returned, `true` otherwise RegularExpression regex; RegularExpression::Match regex_match(3); @@ -633,8 +633,9 @@ // subelements, there may be more than one instance of the ElementHeader // struct. With this first instance being the root element, and the other // instances being the root's descendants. To identify which instances are an - // ElementHeader's children, each struct is immediately followed by a sequence - // of consecutive offsets to the start of its child structs. These offsets are + // ElementHeader's children, each struct is immediately followed by a + // sequence of consecutive offsets to the start of its child structs. These + // offsets are // 4 bytes in size, and the 0 offset signifies no more children. struct FileHeader { uint8_t ident[4]; // ASCII 'RSAD' identifying the file @@ -653,8 +654,8 @@ // Monotonically increasing from 1 static uint32_t ID; - // Maps Allocation DataType enum and vector size to printable strings - // using mapping from RenderScript numerical types summary documentation + // Maps Allocation DataType enum and vector size to printable strings using + // mapping from RenderScript numerical types summary documentation static const char *RsDataTypeToString[][4]; // Maps Allocation DataKind enum to printable strings @@ -844,11 +845,10 @@ lldb_private::SymbolContext &context, Address *, bool) { // We need to have access to the list of reductions currently parsed, as - // reduce names don't actually exist as - // symbols in a module. They are only identifiable by parsing the .rs.info - // packet, or finding the expand symbol. We - // therefore need access to the list of parsed rs modules to properly resolve - // reduction names. + // reduce names don't actually exist as symbols in a module. They are only + // identifiable by parsing the .rs.info packet, or finding the expand symbol. + // We therefore need access to the list of parsed rs modules to properly + // resolve reduction names. Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); ModuleSP module = context.module_sp; @@ -967,8 +967,8 @@ log->Printf("%s: Placed %sbreakpoint on %s", __FUNCTION__, new_bp ? "new " : "", k.m_name.AsCString()); - // exit after placing the first breakpoint if we do not intend to stop - // on all kernels making up this script group + // exit after placing the first breakpoint if we do not intend to stop on + // all kernels making up this script group if (!m_stop_on_all) break; } @@ -1684,8 +1684,8 @@ const ModuleSP module = rsmodule_sp->m_module; const FileSpec &file = module->GetPlatformFileSpec(); - // Iterate over all of the scripts that we currently know of. - // Note: We cant push or pop to m_scripts here or it may invalidate rs_script. + // Iterate over all of the scripts that we currently know of. Note: We cant + // push or pop to m_scripts here or it may invalidate rs_script. for (const auto &rs_script : m_scripts) { // Extract the expected .so file path for this script. std::string shared_lib; @@ -1825,9 +1825,9 @@ // rsaTypeGetNativeData(Context*, Type*, void* typeData, size) Pack the // data in the following way mHal.state.dimX; mHal.state.dimY; - // mHal.state.dimZ; mHal.state.lodCount; mHal.state.faces; mElement; into - // typeData Need to specify 32 or 64 bit for uint_t since this differs - // between devices + // mHal.state.dimZ; mHal.state.lodCount; mHal.state.faces; mElement; + // into typeData Need to specify 32 or 64 bit for uint_t since this + // differs between devices JIT_TEMPLATE_CONTEXT "uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(ctxt" ", 0x%" PRIx64 ", data, 6); data[0]", // eExprTypeDimX @@ -1882,10 +1882,10 @@ } } // end of the anonymous namespace -// JITs the RS runtime for the internal data pointer of an allocation. Is passed -// x,y,z coordinates for the pointer to a specific element. Then sets the -// data_ptr member in Allocation with the result. Returns true on success, false -// otherwise +// JITs the RS runtime for the internal data pointer of an allocation. Is +// passed x,y,z coordinates for the pointer to a specific element. Then sets +// the data_ptr member in Allocation with the result. Returns true on success, +// false otherwise bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc, StackFrame *frame_ptr, uint32_t x, uint32_t y, uint32_t z) { @@ -1961,8 +1961,8 @@ } // JITs the RS runtime for information about the dimensions and type of an -// allocation Then sets dimension and element_ptr members in Allocation with the -// result. Returns true on success, false otherwise +// allocation Then sets dimension and element_ptr members in Allocation with +// the result. Returns true on success, false otherwise bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc, StackFrame *frame_ptr) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); @@ -2245,9 +2245,8 @@ } // JITs the RS runtime for information about the stride between rows in the -// allocation. This is done to detect padding, since allocated memory is 16-byte -// aligned. -// Returns true on success, false otherwise +// allocation. This is done to detect padding, since allocated memory is +// 16-byte aligned. Returns true on success, false otherwise bool RenderScriptRuntime::JITAllocationStride(AllocationDetails *alloc, StackFrame *frame_ptr) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); @@ -2313,9 +2312,8 @@ } // Function attempts to set the type_name member of the paramaterised Element -// object. -// This string should be the name of the struct type the Element represents. -// We need this string for pretty printing the Element to users. +// object. This string should be the name of the struct type the Element +// represents. We need this string for pretty printing the Element to users. void RenderScriptRuntime::FindStructTypeName(Element &elem, StackFrame *frame_ptr) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); @@ -2333,9 +2331,8 @@ RegularExpression(llvm::StringRef(".")), true, UINT32_MAX, var_list); // Iterate over all the global variables looking for one with a matching type - // to the Element. - // We make the assumption a match exists since there needs to be a global - // variable to reflect the struct type back into java host code. + // to the Element. We make the assumption a match exists since there needs to + // be a global variable to reflect the struct type back into java host code. for (uint32_t i = 0; i < var_list.GetSize(); ++i) { const VariableSP var_sp(var_list.GetVariableAtIndex(i)); if (!var_sp) @@ -2347,15 +2344,14 @@ // Find the number of variable fields. // If it has no fields, or more fields than our Element, then it can't be - // the struct we're looking for. - // Don't check for equality since RS can add extra struct members for - // padding. + // the struct we're looking for. Don't check for equality since RS can add + // extra struct members for padding. size_t num_children = valobj_sp->GetNumChildren(); if (num_children > elem.children.size() || num_children == 0) continue; - // Iterate over children looking for members with matching field names. - // If all the field names match, this is likely the struct we want. + // Iterate over children looking for members with matching field names. If + // all the field names match, this is likely the struct we want. // TODO: This could be made more robust by also checking children data // sizes, or array size bool found = true; @@ -2404,8 +2400,8 @@ } // Function sets the datum_size member of Element. Representing the size of a -// single instance including padding. -// Assumes the relevant allocation information has already been jitted. +// single instance including padding. Assumes the relevant allocation +// information has already been jitted. void RenderScriptRuntime::SetElementSize(Element &elem) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); const Element::DataType type = *elem.type.get(); @@ -2446,9 +2442,9 @@ data_size + padding); } -// Given an allocation, this function copies the allocation contents from device -// into a buffer on the heap. -// Returning a shared pointer to the buffer containing the data. +// Given an allocation, this function copies the allocation contents from +// device into a buffer on the heap. Returning a shared pointer to the buffer +// containing the data. std::shared_ptr RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc, StackFrame *frame_ptr) { @@ -2496,9 +2492,8 @@ return buffer; } -// Function copies data from a binary file into an allocation. -// There is a header at the start of the file, FileHeader, before the data -// content itself. +// Function copies data from a binary file into an allocation. There is a +// header at the start of the file, FileHeader, before the data content itself. // Information from this header is used to display warnings to the user about // incompatibilities bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id, @@ -2630,7 +2625,8 @@ // Calculate size of allocation data in file size_t size = data_sp->GetByteSize() - file_header->hdr_size; - // Check if the target allocation and file both have the same total data size. + // Check if the target allocation and file both have the same total data + // size. const uint32_t alloc_size = *alloc->size.get(); if (alloc_size != size) { strm.Printf("Warning: Mismatched allocation sizes - file 0x%" PRIx64 @@ -2660,15 +2656,15 @@ // Function takes as parameters a byte buffer, which will eventually be written // to file as the element header, an offset into that buffer, and an Element -// that will be saved into the buffer at the parametrised offset. -// Return value is the new offset after writing the element into the buffer. -// Elements are saved to the file as the ElementHeader struct followed by -// offsets to the structs of all the element's children. +// that will be saved into the buffer at the parametrised offset. Return value +// is the new offset after writing the element into the buffer. Elements are +// saved to the file as the ElementHeader struct followed by offsets to the +// structs of all the element's children. size_t RenderScriptRuntime::PopulateElementHeaders( const std::shared_ptr header_buffer, size_t offset, const Element &elem) { - // File struct for an element header with all the relevant details copied from - // elem. We assume members are valid already. + // File struct for an element header with all the relevant details copied + // from elem. We assume members are valid already. AllocationDetails::ElementHeader elem_header; elem_header.type = *elem.type.get(); elem_header.kind = *elem.type_kind.get(); @@ -2678,9 +2674,8 @@ elem.array_size.isValid() ? *elem.array_size.get() : 0; const size_t elem_header_size = sizeof(AllocationDetails::ElementHeader); - // Copy struct into buffer and advance offset - // We assume that header_buffer has been checked for nullptr before this - // method is called + // Copy struct into buffer and advance offset We assume that header_buffer + // has been checked for nullptr before this method is called memcpy(header_buffer.get() + offset, &elem_header, elem_header_size); offset += elem_header_size; @@ -2721,8 +2716,8 @@ return size; } -// Function copies allocation contents into a binary file. This file can then be -// loaded later into a different allocation. There is a header, FileHeader, +// Function copies allocation contents into a binary file. This file can then +// be loaded later into a different allocation. There is a header, FileHeader, // before the allocation data containing meta-data. bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const char *path, @@ -2852,8 +2847,8 @@ if (module_sp) { for (const auto &rs_module : m_rsmodules) { if (rs_module->m_module == module_sp) { - // Check if the user has enabled automatically breaking on - // all RS kernels. + // Check if the user has enabled automatically breaking on all RS + // kernels. if (m_breakAllKernels) BreakOnModuleKernels(rs_module); @@ -2975,11 +2970,10 @@ size_t n_lines) { // The list of reduction kernels in the `.rs.info` symbol is of the form // "signature - accumulatordatasize - reduction_name - initializer_name - - // accumulator_name - combiner_name - - // outconverter_name - halter_name" - // Where a function is not explicitly named by the user, or is not generated - // by the compiler, it is named "." so the - // dash separated list should always be 8 items long + // accumulator_name - combiner_name - outconverter_name - halter_name" Where + // a function is not explicitly named by the user, or is not generated by the + // compiler, it is named "." so the dash separated list should always be 8 + // items long Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); // Skip the exportReduceCount line ++lines; @@ -3069,8 +3063,7 @@ } // The .rs.info symbol in renderscript modules contains a string which needs to -// be parsed. -// The string is basic and is parsed on a line by line basis. +// be parsed. The string is basic and is parsed on a line by line basis. bool RSModuleDescriptor::ParseRSInfo() { assert(m_module); Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); @@ -3137,8 +3130,8 @@ const auto handler = rs_info_handler(key); if (handler == -1) continue; - // getAsInteger returns `true` on an error condition - we're only interested - // in numeric fields at the moment + // getAsInteger returns `true` on an error condition - we're only + // interested in numeric fields at the moment uint64_t n_lines; if (val.getAsInteger(10, n_lines)) { LLDB_LOGV(log, "Failed to parse non-numeric '.rs.info' section {0}", @@ -3213,9 +3206,8 @@ std::map contextReferences; - // Iterate over all of the currently discovered scripts. - // Note: We cant push or pop from m_scripts inside this loop or it may - // invalidate script. + // Iterate over all of the currently discovered scripts. Note: We cant push + // or pop from m_scripts inside this loop or it may invalidate script. for (const auto &script : m_scripts) { if (!script->context.isValid()) continue; @@ -3393,15 +3385,15 @@ if ((type == Element::RS_TYPE_NONE) && (alloc->element.children.size() > 0) && (alloc->element.type_name != Element::GetFallbackStructName())) { - // Here we are dumping an Element of struct type. - // This is done using expression evaluation with the name of the - // struct type and pointer to element. - // Don't print the name of the resulting expression, since this will - // be '$[0-9]+' + // Here we are dumping an Element of struct type. This is done using + // expression evaluation with the name of the struct type and pointer + // to element. Don't print the name of the resulting expression, + // since this will be '$[0-9]+' DumpValueObjectOptions expr_options; expr_options.SetHideName(true); - // Setup expression as derefrencing a pointer cast to element address. + // Setup expression as derefrencing a pointer cast to element + // address. char expr_char_buffer[jit_max_expr_size]; int written = snprintf(expr_char_buffer, jit_max_expr_size, "*(%s*) 0x%" PRIx64, @@ -3435,9 +3427,9 @@ return true; } -// Function recalculates all our cached information about allocations by jitting -// the RS runtime regarding each allocation we know about. Returns true if all -// allocations could be recomputed, false otherwise. +// Function recalculates all our cached information about allocations by +// jitting the RS runtime regarding each allocation we know about. Returns true +// if all allocations could be recomputed, false otherwise. bool RenderScriptRuntime::RecomputeAllAllocations(Stream &strm, StackFrame *frame_ptr) { bool success = true; @@ -3601,8 +3593,8 @@ } } -// Given the name of a kernel this function creates a breakpoint using our -// own breakpoint resolver, and returns the Breakpoint shared pointer. +// Given the name of a kernel this function creates a breakpoint using our own +// breakpoint resolver, and returns the Breakpoint shared pointer. BreakpointSP RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) { Log *log( @@ -3743,8 +3735,8 @@ log->Printf("%s - Found .expand function '%s'", __FUNCTION__, func_name.GetCString()); - // Get values for variables in .expand frame that tell us the current kernel - // invocation + // Get values for variables in .expand frame that tell us the current + // kernel invocation uint64_t x, y, z; bool found = GetFrameVarAsUnsigned(frame_sp, x_expr, x) && GetFrameVarAsUnsigned(frame_sp, y_expr, y) && @@ -3765,12 +3757,11 @@ // Callback when a kernel breakpoint hits and we're looking for a specific // coordinate. Baton parameter contains a pointer to the target coordinate we -// want to break on. -// Function then checks the .expand frame for the current coordinate and breaks -// to user if it matches. -// Parameter 'break_id' is the id of the Breakpoint which made the callback. -// Parameter 'break_loc_id' is the id for the BreakpointLocation which was hit, -// a single logical breakpoint can have multiple addresses. +// want to break on. Function then checks the .expand frame for the current +// coordinate and breaks to user if it matches. Parameter 'break_id' is the id +// of the Breakpoint which made the callback. Parameter 'break_loc_id' is the +// id for the BreakpointLocation which was hit, a single logical breakpoint can +// have multiple addresses. bool RenderScriptRuntime::KernelBreakpointHit(void *baton, StoppointCallbackContext *ctx, user_id_t break_id, @@ -3845,12 +3836,10 @@ m_conditional_breaks[bp->GetID()] = std::unique_ptr(baton); } -// Tries to set a breakpoint on the start of a kernel, resolved using the kernel -// name. Argument 'coords', represents a three dimensional coordinate which can -// be -// used to specify a single kernel instance to break on. If this is set then we -// add a callback -// to the breakpoint. +// Tries to set a breakpoint on the start of a kernel, resolved using the +// kernel name. Argument 'coords', represents a three dimensional coordinate +// which can be used to specify a single kernel instance to break on. If this +// is set then we add a callback to the breakpoint. bool RenderScriptRuntime::PlaceBreakpointOnKernel(TargetSP target, Stream &messages, const char *name, @@ -4270,8 +4259,8 @@ }; // Matching a comma separated list of known words is fairly - // straightforward with PCRE, but we're - // using ERE, so we end up with a little ugliness... + // straightforward with PCRE, but we're using ERE, so we end up with a + // little ugliness... RegularExpression::Match match(/* max_matches */ 5); RegularExpression match_type_list( llvm::StringRef("^([[:alpha:]]+)(,[[:alpha:]]+){0,4}$")); Index: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp =================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -46,18 +46,15 @@ bool isRSLargeReturnCall(llvm::Module &module, llvm::CallInst *call_inst) { // i686 and x86_64 returns for large vectors in the RenderScript API are not - // handled as normal - // register pairs, but as a hidden sret type. This is not reflected in the - // debug info or mangled - // symbol name, and the android ABI for x86 and x86_64, (as well as the - // emulators) specifies there is - // no AVX, so bcc generates an sret function because we cannot natively return + // handled as normal register pairs, but as a hidden sret type. This is not + // reflected in the debug info or mangled symbol name, and the android ABI + // for x86 and x86_64, (as well as the emulators) specifies there is no AVX, + // so bcc generates an sret function because we cannot natively return // 256 bit vectors. // This function simply checks whether a function has a > 128bit return type. - // It is perhaps an - // unreliable heuristic, and relies on bcc not generating AVX code, so if the - // android ABI one day - // provides for AVX, this function may go out of fashion. + // It is perhaps an unreliable heuristic, and relies on bcc not generating + // AVX code, so if the android ABI one day provides for AVX, this function + // may go out of fashion. (void)module; if (!call_inst || !call_inst->getCalledFunction()) return false; @@ -88,12 +85,11 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) { // on x86 StructReturn functions return a pointer to the return value, rather - // than the return - // value itself [ref](http://www.agner.org/optimize/calling_conventions.pdf - // section 6). - // We create a return type by getting the pointer type of the old return type, - // and inserting a new - // initial argument of pointer type of the original return type. + // than the return value itself + // [ref](http://www.agner.org/optimize/calling_conventions.pdf section 6). We + // create a return type by getting the pointer type of the old return type, + // and inserting a new initial argument of pointer type of the original + // return type. Log *log( GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS)); @@ -112,8 +108,7 @@ orig_type->param_end()}; // This may not work if the function is somehow declared void as llvm is - // strongly typed - // and represents void* with i8* + // strongly typed and represents void* with i8* assert(!orig_type->getReturnType()->isVoidTy() && "Cannot add StructRet attribute to void function"); llvm::PointerType *return_type_ptr_type = @@ -126,8 +121,8 @@ if (log) log->Printf("%s - return type pointer type for StructRet clone @ '0x%p':\n", __FUNCTION__, (void *)return_type_ptr_type); - // put the the sret pointer argument in place at the beginning of the argument - // list. + // put the the sret pointer argument in place at the beginning of the + // argument list. params.emplace(params.begin(), return_type_ptr_type); assert(params.size() == num_params + 1); return llvm::FunctionType::get(return_type_ptr_type, params, @@ -157,11 +152,9 @@ bool fixupX86StructRetCalls(llvm::Module &module) { bool changed = false; - // changing a basic block while iterating over it seems to have some undefined - // behaviour - // going on so we find all RS callsites first, then fix them up after - // consuming - // the iterator. + // changing a basic block while iterating over it seems to have some + // undefined behaviour going on so we find all RS callsites first, then fix + // them up after consuming the iterator. std::set rs_callsites; if (!findRSCallSites(module, rs_callsites, isRSLargeReturnCall)) return false; @@ -180,8 +173,7 @@ // Allocate enough space to store the return value of the original function // we pass a pointer to this allocation as the StructRet param, and then - // copy its - // value into the lldb return value + // copy its value into the lldb return value const llvm::DataLayout &DL = module.getDataLayout(); llvm::AllocaInst *return_value_alloc = new llvm::AllocaInst( func->getReturnType(), DL.getAllocaAddrSpace(), "var_vector_return_alloc", @@ -222,19 +214,15 @@ bool fixupRSAllocationStructByValCalls(llvm::Module &module) { // On x86_64, calls to functions in the RS runtime that take an - // `rs_allocation` type argument - // are actually handled as by-ref params by bcc, but appear to be passed by - // value by lldb (the callsite all use - // `struct byval`). - // On x86_64 Linux, struct arguments are transferred in registers if the - // struct size is no bigger than - // 128bits [ref](http://www.agner.org/optimize/calling_conventions.pdf) - // section 7.1 "Passing and returning objects" - // otherwise passed on the stack. - // an object of type `rs_allocation` is actually 256bits, so should be passed - // on the stack. However, code generated - // by bcc actually treats formal params of type `rs_allocation` as - // `rs_allocation *` so we need to convert the + // `rs_allocation` type argument are actually handled as by-ref params by + // bcc, but appear to be passed by value by lldb (the callsite all use + // `struct byval`). On x86_64 Linux, struct arguments are transferred in + // registers if the struct size is no bigger than 128bits + // [ref](http://www.agner.org/optimize/calling_conventions.pdf) section 7.1 + // "Passing and returning objects" otherwise passed on the stack. an object + // of type `rs_allocation` is actually 256bits, so should be passed on the + // stack. However, code generated by bcc actually treats formal params of + // type `rs_allocation` as `rs_allocation *` so we need to convert the // calling convention to pass by reference, and remove any hint of byval from // formal parameters. bool changed = false; Index: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -89,9 +89,9 @@ str.assign((const char *)data.GetData(&offset, 16), 16); if (str.find("#1/") == 0) { - // If the name is longer than 16 bytes, or contains an embedded space - // then it will use this format where the length of the name is - // here and the name characters are after this header. + // If the name is longer than 16 bytes, or contains an embedded space then + // it will use this format where the length of the name is here and the + // name characters are after this header. ar_name_len = strtoul(str.c_str() + 3, &err, 10); } else { // Strip off any trailing spaces. @@ -203,8 +203,8 @@ shared_ptr archive_sp; Archive::Map &archive_map = Archive::GetArchiveCache(); Archive::Map::iterator pos = archive_map.find(file); - // Don't cache a value for "archive_map.end()" below since we might - // delete an archive entry... + // Don't cache a value for "archive_map.end()" below since we might delete an + // archive entry... while (pos != archive_map.end() && pos->first == file) { bool match = true; if (arch.IsValid() && @@ -217,14 +217,13 @@ if (pos->second->GetModificationTime() == time) { return pos->second; } else { - // We have a file at the same path with the same architecture - // whose modification time doesn't match. It doesn't make sense - // for us to continue to use this BSD archive since we cache only - // the object info which consists of file time info and also the - // file offset and file size of any contained objects. Since - // this information is now out of date, we won't get the correct - // information if we go and extract the file data, so we should - // remove the old and outdated entry. + // We have a file at the same path with the same architecture whose + // modification time doesn't match. It doesn't make sense for us to + // continue to use this BSD archive since we cache only the object info + // which consists of file time info and also the file offset and file + // size of any contained objects. Since this information is now out of + // date, we won't get the correct information if we go and extract the + // file data, so we should remove the old and outdated entry. archive_map.erase(pos); pos = archive_map.find(file); continue; // Continue to next iteration so we don't increment pos @@ -295,9 +294,9 @@ return nullptr; if (data_sp) { - // We have data, which means this is the first 512 bytes of the file - // Check to see if the magic bytes match and if they do, read the entire - // table of contents for the archive and cache it + // We have data, which means this is the first 512 bytes of the file Check + // to see if the magic bytes match and if they do, read the entire table of + // contents for the archive and cache it DataExtractor data; data.SetData(data_sp, data_offset, length); if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) { @@ -389,8 +388,8 @@ m_file, module_sp->GetArchitecture(), module_sp->GetModificationTime(), m_offset, m_data); } - // Clear the m_data that contains the entire archive - // data and let our m_archive_sp hold onto the data. + // Clear the m_data that contains the entire archive data and let our + // m_archive_sp hold onto the data. m_data.Clear(); } } @@ -453,9 +452,9 @@ lldb::offset_t data_offset, lldb::offset_t file_offset, lldb::offset_t file_size, lldb_private::ModuleSpecList &specs) { - // We have data, which means this is the first 512 bytes of the file - // Check to see if the magic bytes match and if they do, read the entire - // table of contents for the archive and cache it + // We have data, which means this is the first 512 bytes of the file Check to + // see if the magic bytes match and if they do, read the entire table of + // contents for the archive and cache it DataExtractor data; data.SetData(data_sp, data_offset, data_sp->GetByteSize()); if (!file || !data_sp || !ObjectContainerBSDArchive::MagicBytesMatch(data)) @@ -505,8 +504,8 @@ const size_t end_count = specs.GetSize(); size_t num_specs_added = end_count - initial_count; if (set_archive_arch && num_specs_added > 0) { - // The archive was created but we didn't have an architecture - // so we need to set it + // The archive was created but we didn't have an architecture so we need to + // set it for (size_t i = initial_count; i < end_count; ++i) { ModuleSpec module_spec; if (specs.GetModuleSpecAtIndex(i, module_spec)) { Index: lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp +++ lldb/trunk/source/Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.cpp @@ -44,8 +44,8 @@ const lldb::ModuleSP &module_sp, DataBufferSP &data_sp, lldb::offset_t data_offset, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length) { - // We get data when we aren't trying to look for cached container information, - // so only try and look for an architecture slice if we get data + // We get data when we aren't trying to look for cached container + // information, so only try and look for an architecture slice if we get data if (data_sp) { DataExtractor data; data.SetData(data_sp, data_offset, length); @@ -81,8 +81,8 @@ bool ObjectContainerUniversalMachO::ParseHeader() { bool success = ParseHeader(m_data, m_header, m_fat_archs); - // We no longer need any data, we parsed all we needed to parse - // and cached it in m_header and m_fat_archs + // We no longer need any data, we parsed all we needed to parse and cached it + // in m_header and m_fat_archs m_data.Clear(); return success; } @@ -92,8 +92,7 @@ std::vector &fat_archs) { bool success = false; // Store the file offset for this universal file as we could have a universal - // .o file - // in a BSD archive, or be contained in another kind of object. + // .o file in a BSD archive, or be contained in another kind of object. // Universal mach-o files always have their headers in big endian. lldb::offset_t offset = 0; data.SetByteOrder(eByteOrderBig); Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp @@ -140,13 +140,12 @@ if (data.GetU32(offset, &e_flags, 1) == NULL) return false; - // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and - // e_shstrndx. + // Read e_ehsize, e_phentsize, e_phnum, e_shentsize, e_shnum and e_shstrndx. if (data.GetU16(offset, &e_ehsize, 6) == NULL) return false; - // Initialize e_phnum, e_shnum, and e_shstrndx with the values - // read from the header. + // Initialize e_phnum, e_shnum, and e_shstrndx with the values read from the + // header. e_phnum = e_phnum_hdr; e_shnum = e_shnum_hdr; e_shstrndx = e_shstrndx_hdr; Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -240,11 +240,10 @@ if (data.GetU32(offset, &n_namesz, 3) == NULL) return false; - // The name field is required to be nul-terminated, and n_namesz - // includes the terminating nul in observed implementations (contrary - // to the ELF-64 spec). A special case is needed for cores generated - // by some older Linux versions, which write a note named "CORE" - // without a nul terminator and n_namesz = 4. + // The name field is required to be nul-terminated, and n_namesz includes the + // terminating nul in observed implementations (contrary to the ELF-64 spec). + // A special case is needed for cores generated by some older Linux versions, + // which write a note named "CORE" without a nul terminator and n_namesz = 4. if (n_namesz == 4) { char buf[4]; if (data.ExtractBytes(*offset, 4, data.GetByteOrder(), buf) != 4) @@ -295,7 +294,8 @@ uint32_t arch_variant = ArchSpec::eMIPSSubType_unknown; uint32_t fileclass = header.e_ident[EI_CLASS]; - // If there aren't any elf flags available (e.g core elf file) then return default + // If there aren't any elf flags available (e.g core elf file) then return + // default // 32 or 64 bit arch (without any architecture revision) based on object file's class. if (header.e_type == ET_CORE) { switch (fileclass) { @@ -549,8 +549,8 @@ DataExtractor segment_data; if (segment_data.SetData(object_data, ph_offset, ph_size) != ph_size) { - // The ELF program header contained incorrect data, - // probably corefile is incomplete or corrupted. + // The ELF program header contained incorrect data, probably corefile + // is incomplete or corrupted. break; } @@ -595,8 +595,8 @@ // // WARNING : This function is being deprecated -// It's functionality has moved to ArchSpec::SetArchitecture -// This function is only being kept to validate the move. +// It's functionality has moved to ArchSpec::SetArchitecture This function is +// only being kept to validate the move. // // TODO : Remove this function static bool GetOsFromOSABI(unsigned char osabi_byte, @@ -677,10 +677,10 @@ data_sp = MapFileData(file, -1, file_offset); if (data_sp) data.SetData(data_sp); - // In case there is header extension in the section #0, the header - // we parsed above could have sentinel values for e_phnum, e_shnum, - // and e_shstrndx. In this case we need to reparse the header - // with a bigger data source to get the actual values. + // In case there is header extension in the section #0, the header we + // parsed above could have sentinel values for e_phnum, e_shnum, and + // e_shstrndx. In this case we need to reparse the header with a + // bigger data source to get the actual values. if (header.HasHeaderExtension()) { lldb::offset_t header_offset = data_offset; header.Parse(data, &header_offset); @@ -736,8 +736,8 @@ uuid.SetBytes(uuidt, sizeof(uuidt)); } else if (core_notes_crc) { // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make - // it look different form - // .gnu_debuglink crc followed by 4 bytes of note segments crc. + // it look different form .gnu_debuglink crc followed by 4 bytes + // of note segments crc. uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0}; uuid.SetBytes(uuidt, sizeof(uuidt)); } @@ -823,21 +823,19 @@ size_t sect_idx = 0; for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) { - // Iterate through the object file sections to find all - // of the sections that have SHF_ALLOC in their flag bits. + // Iterate through the object file sections to find all of the sections + // that have SHF_ALLOC in their flag bits. SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->Test(SHF_ALLOC)) { lldb::addr_t load_addr = section_sp->GetFileAddress(); // We don't want to update the load address of a section with type // eSectionTypeAbsoluteAddress as they already have the absolute load - // address - // already specified + // address already specified if (section_sp->GetType() != eSectionTypeAbsoluteAddress) load_addr += value; // On 32-bit systems the load address have to fit into 4 bytes. The - // rest of - // the bytes are the overflow from the addition. + // rest of the bytes are the overflow from the addition. if (GetAddressByteSize() == 4) load_addr &= 0xFFFFFFFF; @@ -869,9 +867,8 @@ if (!symtab) return eAddressClassUnknown; - // The address class is determined based on the symtab. Ask it from the object - // file what - // contains the symtab information. + // The address class is determined based on the symtab. Ask it from the + // object file what contains the symtab information. ObjectFile *symtab_objfile = symtab->GetObjectFile(); if (symtab_objfile != nullptr && symtab_objfile != this) return symtab_objfile->GetAddressClass(file_addr); @@ -882,8 +879,8 @@ auto ub = m_address_class_map.upper_bound(file_addr); if (ub == m_address_class_map.begin()) { - // No entry in the address class map before the address. Return - // default address class for an address in a code section. + // No entry in the address class map before the address. Return default + // address class for an address in a code section. return eAddressClassCode; } @@ -925,8 +922,8 @@ core_notes_crc = CalculateELFNotesSegmentsCRC32(m_program_headers, m_data); if (core_notes_crc) { - // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it - // look different form .gnu_debuglink crc - followed by 4 bytes of note + // Use 8 bytes - first 4 bytes for *magic* prefix, mainly to make it look + // different form .gnu_debuglink crc - followed by 4 bytes of note // segments crc. uint32_t uuidt[4] = {g_core_uuid_magic, core_notes_crc, 0, 0}; m_uuid.SetBytes(uuidt, sizeof(uuidt)); @@ -996,8 +993,8 @@ ELFDynamic &symbol = m_dynamic_symbols[i]; if (symbol.d_tag == DT_DEBUG) { - // Compute the offset as the number of previous entries plus the - // size of d_tag. + // Compute the offset as the number of previous entries plus the size of + // d_tag. addr_t offset = i * dynsym_hdr->sh_entsize + GetAddressByteSize(); return Address(dynsym_section_sp, offset); } @@ -1330,8 +1327,8 @@ arch_spec.GetTriple().setVendor(llvm::Triple::VendorType::CSR); // TODO At some point the description string could be processed. - // It could provide a steer towards the kalimba variant which - // this ELF targets. + // It could provide a steer towards the kalimba variant which this ELF + // targets. if (note.n_descsz) { const char *cstr = data.GetCStr(&offset, llvm::alignTo(note.n_descsz, 4)); @@ -1346,36 +1343,28 @@ // register info arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux); } else if (note.n_name == LLDB_NT_OWNER_CORE) { - // Parse the NT_FILE to look for stuff in paths to shared libraries - // As the contents look like this in a 64 bit ELF core file: - // count = 0x000000000000000a (10) - // page_size = 0x0000000000001000 (4096) - // Index start end file_ofs path - // ===== ------------------ ------------------ ------------------ - // ------------------------------------- - // [ 0] 0x0000000000400000 0x0000000000401000 0x0000000000000000 - // /tmp/a.out - // [ 1] 0x0000000000600000 0x0000000000601000 0x0000000000000000 - // /tmp/a.out - // [ 2] 0x0000000000601000 0x0000000000602000 0x0000000000000001 - // /tmp/a.out + // Parse the NT_FILE to look for stuff in paths to shared libraries As + // the contents look like this in a 64 bit ELF core file: count = + // 0x000000000000000a (10) page_size = 0x0000000000001000 (4096) Index + // start end file_ofs path ===== + // ------------------ ------------------ ------------------ + // ------------------------------------- [ 0] 0x0000000000400000 + // 0x0000000000401000 0x0000000000000000 /tmp/a.out [ 1] + // 0x0000000000600000 0x0000000000601000 0x0000000000000000 /tmp/a.out [ + // 2] 0x0000000000601000 0x0000000000602000 0x0000000000000001 /tmp/a.out // [ 3] 0x00007fa79c9ed000 0x00007fa79cba8000 0x0000000000000000 - // /lib/x86_64-linux-gnu/libc-2.19.so - // [ 4] 0x00007fa79cba8000 0x00007fa79cda7000 0x00000000000001bb - // /lib/x86_64-linux-gnu/libc-2.19.so - // [ 5] 0x00007fa79cda7000 0x00007fa79cdab000 0x00000000000001ba - // /lib/x86_64-linux-gnu/libc-2.19.so - // [ 6] 0x00007fa79cdab000 0x00007fa79cdad000 0x00000000000001be - // /lib/x86_64-linux-gnu/libc-2.19.so - // [ 7] 0x00007fa79cdb2000 0x00007fa79cdd5000 0x0000000000000000 - // /lib/x86_64-linux-gnu/ld-2.19.so - // [ 8] 0x00007fa79cfd4000 0x00007fa79cfd5000 0x0000000000000022 - // /lib/x86_64-linux-gnu/ld-2.19.so - // [ 9] 0x00007fa79cfd5000 0x00007fa79cfd6000 0x0000000000000023 - // /lib/x86_64-linux-gnu/ld-2.19.so - // In the 32 bit ELFs the count, page_size, start, end, file_ofs are - // uint32_t - // For reference: see readelf source code (in binutils). + // /lib/x86_64-linux-gnu/libc-2.19.so [ 4] 0x00007fa79cba8000 + // 0x00007fa79cda7000 0x00000000000001bb /lib/x86_64-linux- + // gnu/libc-2.19.so [ 5] 0x00007fa79cda7000 0x00007fa79cdab000 + // 0x00000000000001ba /lib/x86_64-linux-gnu/libc-2.19.so [ 6] + // 0x00007fa79cdab000 0x00007fa79cdad000 0x00000000000001be /lib/x86_64 + // -linux-gnu/libc-2.19.so [ 7] 0x00007fa79cdb2000 0x00007fa79cdd5000 + // 0x0000000000000000 /lib/x86_64-linux-gnu/ld-2.19.so [ 8] + // 0x00007fa79cfd4000 0x00007fa79cfd5000 0x0000000000000022 /lib/x86_64 + // -linux-gnu/ld-2.19.so [ 9] 0x00007fa79cfd5000 0x00007fa79cfd6000 + // 0x0000000000000023 /lib/x86_64-linux-gnu/ld-2.19.so In the 32 bit ELFs + // the count, page_size, start, end, file_ofs are uint32_t For reference: + // see readelf source code (in binutils). if (note.n_type == NT_FILE) { uint64_t count = data.GetAddress(&offset); const char *cstr; @@ -1399,15 +1388,14 @@ } if (arch_spec.IsMIPS() && arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS) - // In case of MIPSR6, the LLDB_NT_OWNER_GNU note is missing - // for some cases (e.g. compile with -nostdlib) - // Hence set OS to Linux + // In case of MIPSR6, the LLDB_NT_OWNER_GNU note is missing for some + // cases (e.g. compile with -nostdlib) Hence set OS to Linux arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux); } } - // Calculate the offset of the next note just in case "offset" has been used - // to poke at the contents of the note data + // Calculate the offset of the next note just in case "offset" has been + // used to poke at the contents of the note data offset = note_offset + note.GetByteSize(); } @@ -1507,13 +1495,12 @@ arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type, header.e_ident[EI_OSABI]); - // Validate if it is ok to remove GetOsFromOSABI. - // Note, that now the OS is determined based on EI_OSABI flag and - // the info extracted from ELF notes (see RefineModuleDetailsFromNote). - // However in some cases that still might be not enough: for example - // a shared library might not have any notes at all - // and have EI_OSABI flag set to System V, - // as result the OS will be set to UnknownOS. + // Validate if it is ok to remove GetOsFromOSABI. Note, that now the OS is + // determined based on EI_OSABI flag and the info extracted from ELF notes + // (see RefineModuleDetailsFromNote). However in some cases that still + // might be not enough: for example a shared library might not have any + // notes at all and have EI_OSABI flag set to System V, as result the OS + // will be set to UnknownOS. GetOsFromOSABI(header.e_ident[EI_OSABI], ostype); spec_ostype = arch_spec.GetTriple().getOS(); assert(spec_ostype == ostype); @@ -1844,23 +1831,19 @@ } // .debug_abbrev – Abbreviations used in the .debug_info section // .debug_aranges – Lookup table for mapping addresses to compilation - // units - // .debug_frame – Call frame information - // .debug_info – The core DWARF information section - // .debug_line – Line number information + // units .debug_frame – Call frame information .debug_info – The core + // DWARF information section .debug_line – Line number information // .debug_loc – Location lists used in DW_AT_location attributes - // .debug_macinfo – Macro information - // .debug_pubnames – Lookup table for mapping object and function names to - // compilation units + // .debug_macinfo – Macro information .debug_pubnames – Lookup table + // for mapping object and function names to compilation units // .debug_pubtypes – Lookup table for mapping type names to compilation - // units - // .debug_ranges – Address ranges used in DW_AT_ranges attributes - // .debug_str – String table used in .debug_info - // MISSING? .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section, - // http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html - // MISSING? .debug-index - - // http://src.chromium.org/viewvc/chrome/trunk/src/build/gdb-add-index?pathrev=144644 - // MISSING? .debug_types - Type descriptions from DWARF 4? See + // units .debug_ranges – Address ranges used in DW_AT_ranges attributes + // .debug_str – String table used in .debug_info MISSING? + // .gnu_debugdata - "mini debuginfo / MiniDebugInfo" section, + // http://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html MISSING? + // .debug-index - http://src.chromium.org/viewvc/chrome/trunk/src/build + // /gdb-add-index?pathrev=144644 MISSING? .debug_types - Type + // descriptions from DWARF 4? See // http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo else if (name == g_sect_name_dwarf_debug_abbrev) sect_type = eSectionTypeDWARFDebugAbbrev; @@ -1943,10 +1926,8 @@ if (eSectionTypeOther == sect_type) { // the kalimba toolchain assumes that ELF section names are free-form. - // It does - // support linkscripts which (can) give rise to various arbitrarily - // named - // sections being "Code" or "Data". + // It does support linkscripts which (can) give rise to various + // arbitrarily named sections being "Code" or "Data". sect_type = kalimbaSectionType(m_header, header); } @@ -2006,11 +1987,9 @@ } // Find the arm/aarch64 mapping symbol character in the given symbol name. -// Mapping symbols have the -// form of "$[.]*". Additionally we recognize cases when the mapping -// symbol prefixed by -// an arbitrary string because if a symbol prefix added to each symbol in the -// object file with +// Mapping symbols have the form of "$[.]*". Additionally we +// recognize cases when the mapping symbol prefixed by an arbitrary string +// because if a symbol prefix added to each symbol in the object file with // objcopy then the mapping symbols are also prefixed. static char FindArmAarch64MappingSymbol(const char *symbol_name) { if (!symbol_name) @@ -2052,19 +2031,15 @@ static ConstString opd_section_name(".opd"); // For ppc64 // On Android the oatdata and the oatexec symbols in the oat and odex files - // covers the full - // .text section what causes issues with displaying unusable symbol name to - // the user and very - // slow unwinding speed because the instruction emulation based unwind plans - // try to emulate all - // instructions in these symbols. Don't add these symbols to the symbol list - // as they have no - // use for the debugger and they are causing a lot of trouble. - // Filtering can't be restricted to Android because this special object file - // don't contain the - // note section specifying the environment to Android but the custom extension - // and file name - // makes it highly unlikely that this will collide with anything else. + // covers the full .text section what causes issues with displaying unusable + // symbol name to the user and very slow unwinding speed because the + // instruction emulation based unwind plans try to emulate all instructions + // in these symbols. Don't add these symbols to the symbol list as they have + // no use for the debugger and they are causing a lot of trouble. Filtering + // can't be restricted to Android because this special object file don't + // contain the note section specifying the environment to Android but the + // custom extension and file name makes it highly unlikely that this will + // collide with anything else. ConstString file_extension = m_file.GetFileNameExtension(); bool skip_oatdata_oatexec = file_extension == ConstString("oat") || file_extension == ConstString("odex"); @@ -2076,8 +2051,8 @@ module_sp ? module_sp->GetSectionList() : nullptr; // Local cache to avoid doing a FindSectionByName for each symbol. The "const - // char*" key must - // came from a ConstString object so they can be compared by pointer + // char*" key must came from a ConstString object so they can be compared by + // pointer std::unordered_map section_name_to_section; unsigned i; @@ -2095,8 +2070,7 @@ continue; // Skipping oatdata and oatexec sections if it is requested. See details - // above the - // definition of skip_oatdata_oatexec for the reasons. + // above the definition of skip_oatdata_oatexec for the reasons. if (skip_oatdata_oatexec && (::strcmp(symbol_name, "oatdata") == 0 || ::strcmp(symbol_name, "oatexec") == 0)) continue; @@ -2127,8 +2101,8 @@ break; case STT_OBJECT: - // The symbol is associated with a data object, such as a variable, - // an array, etc. + // The symbol is associated with a data object, such as a variable, an + // array, etc. symbol_type = eSymbolTypeData; break; @@ -2139,13 +2113,13 @@ case STT_SECTION: // The symbol is associated with a section. Symbol table entries of - // this type exist primarily for relocation and normally have - // STB_LOCAL binding. + // this type exist primarily for relocation and normally have STB_LOCAL + // binding. break; case STT_FILE: - // Conventionally, the symbol's name gives the name of the source - // file associated with the object file. A file symbol has STB_LOCAL + // Conventionally, the symbol's name gives the name of the source file + // associated with the object file. A file symbol has STB_LOCAL // binding, its section index is SHN_ABS, and it precedes the other // STB_LOCAL symbols for the file, if it is present. symbol_type = eSymbolTypeSourceFile; @@ -2228,12 +2202,11 @@ if (arch.GetMachine() == llvm::Triple::arm) { if (symbol_type == eSymbolTypeCode) { if (symbol.st_value & 1) { - // Subtracting 1 from the address effectively unsets - // the low order bit, which results in the address - // actually pointing to the beginning of the symbol. - // This delta will be used below in conjunction with - // symbol.st_value to produce the final symbol_value - // that we store in the symtab. + // Subtracting 1 from the address effectively unsets the low order + // bit, which results in the address actually pointing to the + // beginning of the symbol. This delta will be used below in + // conjunction with symbol.st_value to produce the final + // symbol_value that we store in the symtab. symbol_value_offset = -1; m_address_class_map[symbol.st_value ^ 1] = eAddressClassCodeAlternateISA; @@ -2280,20 +2253,16 @@ } // symbol_value_offset may contain 0 for ARM symbols or -1 for THUMB - // symbols. See above for - // more details. + // symbols. See above for more details. uint64_t symbol_value = symbol.st_value + symbol_value_offset; if (symbol_section_sp == nullptr && section_idx == SHN_ABS && symbol.st_size != 0) { // We don't have a section for a symbol with non-zero size. Create a new - // section for it - // so the address range covered by the symbol is also covered by the - // module (represented - // through the section list). It is needed so module lookup for the - // addresses covered - // by this symbol will be successfull. This case happens for absolute - // symbols. + // section for it so the address range covered by the symbol is also + // covered by the module (represented through the section list). It is + // needed so module lookup for the addresses covered by this symbol will + // be successfull. This case happens for absolute symbols. ConstString fake_section_name(std::string(".absolute.") + symbol_name); symbol_section_sp = std::make_shared
(module_sp, this, SHN_ABS, fake_section_name, @@ -2336,8 +2305,7 @@ Mangled mangled(ConstString(symbol_bare), is_mangled); // Now append the suffix back to mangled and unmangled names. Only do it if - // the - // demangling was successful (string is not empty). + // the demangling was successful (string is not empty). if (has_suffix) { llvm::StringRef suffix = symbol_ref.substr(version_pos); @@ -2353,12 +2321,10 @@ } // In ELF all symbol should have a valid size but it is not true for some - // function symbols - // coming from hand written assembly. As none of the function symbol should - // have 0 size we - // try to calculate the size for these symbols in the symtab with saying - // that their original - // size is not valid. + // function symbols coming from hand written assembly. As none of the + // function symbol should have 0 size we try to calculate the size for + // these symbols in the symtab with saying that their original size is not + // valid. bool symbol_size_valid = symbol.st_size != 0 || symbol.getType() != STT_FUNC; @@ -2387,8 +2353,7 @@ lldb_private::Section *symtab) { if (symtab->GetObjectFile() != this) { // If the symbol table section is owned by a different object file, have it - // do the - // parsing. + // do the parsing. ObjectFileELF *obj_file_elf = static_cast(symtab->GetObjectFile()); return obj_file_elf->ParseSymbolTable(symbol_table, start_id, symtab); @@ -2404,8 +2369,8 @@ assert(symtab_hdr->sh_type == SHT_SYMTAB || symtab_hdr->sh_type == SHT_DYNSYM); - // sh_link: section header index of associated string table. - // Section ID's are ones based. + // sh_link: section header index of associated string table. Section ID's are + // ones based. user_id_t strtab_id = symtab_hdr->sh_link + 1; Section *strtab = section_list->FindSectionByID(strtab_id).get(); @@ -2490,19 +2455,17 @@ return 0; } -// Returns the size of the normal plt entries and the offset of the first normal -// plt entry. The -// 0th entry in the plt table is usually a resolution entry which have different -// size in some -// architectures then the rest of the plt entries. +// Returns the size of the normal plt entries and the offset of the first +// normal plt entry. The 0th entry in the plt table is usually a resolution +// entry which have different size in some architectures then the rest of the +// plt entries. static std::pair GetPltEntrySizeAndOffset(const ELFSectionHeader *rel_hdr, const ELFSectionHeader *plt_hdr) { const elf_xword num_relocations = rel_hdr->sh_size / rel_hdr->sh_entsize; - // Clang 3.3 sets entsize to 4 for 32-bit binaries, but the plt entries are 16 - // bytes. - // So round the entsize up by the alignment if addralign is set. + // Clang 3.3 sets entsize to 4 for 32-bit binaries, but the plt entries are + // 16 bytes. So round the entsize up by the alignment if addralign is set. elf_xword plt_entsize = plt_hdr->sh_addralign ? llvm::alignTo(plt_hdr->sh_entsize, plt_hdr->sh_addralign) @@ -2514,12 +2477,10 @@ // just in case. if (plt_entsize <= 4) { // The linker haven't set the plt_hdr->sh_entsize field. Try to guess the - // size of the plt - // entries based on the number of entries and the size of the plt section - // with the - // assumption that the size of the 0th entry is at least as big as the size - // of the normal - // entries and it isn't much bigger then that. + // size of the plt entries based on the number of entries and the size of + // the plt section with the assumption that the size of the 0th entry is at + // least as big as the size of the normal entries and it isn't much bigger + // then that. if (plt_hdr->sh_addralign) plt_entsize = plt_hdr->sh_size / plt_hdr->sh_addralign / (num_relocations + 1) * plt_hdr->sh_addralign; @@ -2812,8 +2773,7 @@ return NULL; // We always want to use the main object file so we (hopefully) only have one - // cached copy - // of our symtab, dynamic sections, etc. + // cached copy of our symtab, dynamic sections, etc. ObjectFile *module_obj_file = module_sp->GetObjectFile(); if (module_obj_file && module_obj_file != this) return module_obj_file->GetSymtab(); @@ -2828,18 +2788,15 @@ // Sharable objects and dynamic executables usually have 2 distinct symbol // tables, one named ".symtab", and the other ".dynsym". The dynsym is a - // smaller - // version of the symtab that only contains global symbols. The information - // found - // in the dynsym is therefore also found in the symtab, while the reverse is - // not - // necessarily true. + // smaller version of the symtab that only contains global symbols. The + // information found in the dynsym is therefore also found in the symtab, + // while the reverse is not necessarily true. Section *symtab = section_list->FindSectionByType(eSectionTypeELFSymbolTable, true).get(); if (!symtab) { // The symtab section is non-allocable and can be stripped, so if it - // doesn't exist - // then use the dynsym section which should always be there. + // doesn't exist then use the dynsym section which should always be + // there. symtab = section_list->FindSectionByType(eSectionTypeELFDynamicSymbols, true) .get(); @@ -2886,8 +2843,7 @@ } // If we still don't have any symtab then create an empty instance to avoid - // do the section - // lookup next time. + // do the section lookup next time. if (m_symtab_ap == nullptr) m_symtab_ap.reset(new Symtab(this)); @@ -2901,8 +2857,8 @@ { static const char *debug_prefix = ".debug"; - // Set relocated bit so we stop getting called, regardless of - // whether we actually relocate. + // Set relocated bit so we stop getting called, regardless of whether we + // actually relocate. section->SetIsRelocated(true); // We only relocate in ELF relocatable files @@ -2945,12 +2901,10 @@ return; // First we save the new symbols into a separate list and add them to the - // symbol table after - // we colleced all symbols we want to add. This is neccessary because adding a - // new symbol - // invalidates the internal index of the symtab what causing the next lookup - // to be slow because - // it have to recalculate the index first. + // symbol table after we colleced all symbols we want to add. This is + // neccessary because adding a new symbol invalidates the internal index of + // the symtab what causing the next lookup to be slow because it have to + // recalculate the index first. std::vector new_symbols; eh_frame->ForEachFDEEntries([this, symbol_table, section_list, &new_symbols]( @@ -3144,8 +3098,8 @@ //---------------------------------------------------------------------- // DumpELFProgramHeader_p_type // -// Dump an token value for the ELF program header member p_type which -// describes the type of the program header +// Dump an token value for the ELF program header member p_type which describes +// the type of the program header // ---------------------------------------------------------------------- void ObjectFileELF::DumpELFProgramHeader_p_type(Stream *s, elf_word p_type) { const int kStrWidth = 15; @@ -3316,8 +3270,7 @@ if (CalculateType() == eTypeCoreFile && m_arch_spec.TripleOSIsUnspecifiedUnknown()) { // Core files don't have section headers yet they have PT_NOTE program - // headers - // that might shed more light on the architecture + // headers that might shed more light on the architecture if (ParseProgramHeaders()) { for (size_t i = 1, count = GetProgramHeaderCount(); i <= count; ++i) { const elf::ELFProgramHeader *header = GetProgramHeaderByIndex(i); @@ -3378,22 +3331,22 @@ case llvm::ELF::ET_EXEC: // 2 - Executable file // TODO: is there any way to detect that an executable is a kernel - // related executable by inspecting the program headers, section - // headers, symbols, or any other flag bits??? + // related executable by inspecting the program headers, section headers, + // symbols, or any other flag bits??? return eStrataUser; case llvm::ELF::ET_DYN: // 3 - Shared object file // TODO: is there any way to detect that an shared library is a kernel - // related executable by inspecting the program headers, section - // headers, symbols, or any other flag bits??? + // related executable by inspecting the program headers, section headers, + // symbols, or any other flag bits??? return eStrataUnknown; case ET_CORE: // 4 - Core file // TODO: is there any way to detect that an core file is a kernel - // related executable by inspecting the program headers, section - // headers, symbols, or any other flag bits??? + // related executable by inspecting the program headers, section headers, + // symbols, or any other flag bits??? return eStrataUnknown; default: @@ -3468,8 +3421,8 @@ std::vector ObjectFileELF::GetLoadableData(Target &target) { - // Create a list of loadable data from loadable segments, - // using physical addresses if they aren't all null + // Create a list of loadable data from loadable segments, using physical + // addresses if they aren't all null std::vector loadables; size_t header_count = ParseProgramHeaders(); bool should_use_paddr = AnySegmentHasPhysicalAddress(); Index: lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp +++ lldb/trunk/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp @@ -65,8 +65,8 @@ const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length) { - // JIT'ed object file is backed by the ObjectFileJITDelegate, never - // read from a file + // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from + // a file return NULL; } @@ -74,8 +74,8 @@ DataBufferSP &data_sp, const ProcessSP &process_sp, lldb::addr_t header_addr) { - // JIT'ed object file is backed by the ObjectFileJITDelegate, never - // read from memory + // JIT'ed object file is backed by the ObjectFileJITDelegate, never read from + // memory return NULL; } @@ -214,9 +214,8 @@ const size_t num_sections = section_list->GetSize(); // "value" is an offset to apply to each top level segment for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) { - // Iterate through the object file sections to find all - // of the sections that size on disk (to avoid __PAGEZERO) - // and load them + // Iterate through the object file sections to find all of the sections + // that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && section_sp->IsThreadSpecific() == false) { Index: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -161,8 +161,7 @@ case 7: case 8: case 9: - // fancy flavors that encapsulate of the above - // flavors... + // fancy flavors that encapsulate of the above flavors... break; default: @@ -393,8 +392,7 @@ case 7: case 8: case 9: - // fancy flavors that encapsulate of the above - // flavors... + // fancy flavors that encapsulate of the above flavors... break; default: @@ -517,8 +515,7 @@ } // Note that gpr.cpsr is also copied by the above loop; this loop - // technically extends - // one element past the end of the gpr.r[] array. + // technically extends one element past the end of the gpr.r[] array. SetError(GPRRegSet, Read, 0); offset = next_thread_state; @@ -1168,8 +1165,8 @@ case eSectionTypeCode: if (m_header.cputype == llvm::MachO::CPU_TYPE_ARM) { - // For ARM we have a bit in the n_desc field of the symbol - // that tells us ARM/Thumb which is bit 0x0008. + // For ARM we have a bit in the n_desc field of the symbol that + // tells us ARM/Thumb which is bit 0x0008. if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB) return eAddressClassCodeAlternateISA; } @@ -1243,8 +1240,8 @@ case eSymbolTypeTrampoline: case eSymbolTypeResolver: if (m_header.cputype == llvm::MachO::CPU_TYPE_ARM) { - // For ARM we have a bit in the n_desc field of the symbol - // that tells us ARM/Thumb which is bit 0x0008. + // For ARM we have a bit in the n_desc field of the symbol that tells + // us ARM/Thumb which is bit 0x0008. if (symbol->GetFlags() & MACHO_NLIST_ARM_SYMBOL_IS_THUMB) return eAddressClassCodeAlternateISA; } @@ -1360,8 +1357,8 @@ if (m_data.GetU32(&offset, &encryption_cmd, 2) == NULL) break; - // LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for - // the 3 fields we care about, so treat them the same. + // LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 have the same sizes for the + // 3 fields we care about, so treat them the same. if (encryption_cmd.cmd == LC_ENCRYPTION_INFO || encryption_cmd.cmd == LC_ENCRYPTION_INFO_64) { if (m_data.GetU32(&offset, &encryption_cmd.cryptoff, 3)) { @@ -1605,12 +1602,12 @@ context.UnifiedList.FindSectionByName(const_segname)); if (is_dsym && unified_section_sp) { if (const_segname == GetSegmentNameLINKEDIT()) { - // We need to keep the __LINKEDIT segment private to this object - // file only + // We need to keep the __LINKEDIT segment private to this object file + // only add_to_unified = false; } else { - // This is the dSYM file and this section has already been created - // by the object file, no need to create it. + // This is the dSYM file and this section has already been created by the + // object file, no need to create it. add_section = false; } } @@ -1627,12 +1624,12 @@ const bool segment_is_encrypted = (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0; - // Keep a list of mach segments around in case we need to - // get at data that isn't stored in the abstracted Sections. + // Keep a list of mach segments around in case we need to get at data that + // isn't stored in the abstracted Sections. m_mach_segments.push_back(load_cmd); - // Use a segment ID of the segment index shifted left by 8 so they - // never conflict with any of the sections. + // Use a segment ID of the segment index shifted left by 8 so they never + // conflict with any of the sections. SectionSP segment_sp; if (add_section && (const_segname || is_core)) { segment_sp.reset(new Section( @@ -1640,9 +1637,8 @@ this, // Object file to which this sections belongs ++context.NextSegmentIdx << 8, // Section ID is the 1 based segment index - // shifted right by 8 bits as not to collide - // with any of the 256 section IDs that are - // possible + // shifted right by 8 bits as not to collide with any of the 256 + // section IDs that are possible const_segname, // Name of this section eSectionTypeContainer, // This section is a container of other // sections. @@ -1665,27 +1661,24 @@ if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) { // Check to see if the module was read from memory? if (module_sp->GetObjectFile()->GetHeaderAddress().IsValid()) { - // We have a module that is in memory and needs to have its - // file address adjusted. We need to do this because when we - // load a file from memory, its addresses will be slid already, - // yet the addresses in the new symbol file will still be - // unslid. Since everything is stored as section offset, this - // shouldn't cause any problems. + // We have a module that is in memory and needs to have its file + // address adjusted. We need to do this because when we load a file + // from memory, its addresses will be slid already, yet the addresses + // in the new symbol file will still be unslid. Since everything is + // stored as section offset, this shouldn't cause any problems. - // Make sure we've parsed the symbol table from the - // ObjectFile before we go around changing its Sections. + // Make sure we've parsed the symbol table from the ObjectFile before + // we go around changing its Sections. module_sp->GetObjectFile()->GetSymtab(); - // eh_frame would present the same problems but we parse that - // on a per-function basis as-needed so it's more difficult to - // remove its use of the Sections. Realistically, the - // environments where this code path will be taken will not - // have eh_frame sections. + // eh_frame would present the same problems but we parse that on a per- + // function basis as-needed so it's more difficult to remove its use of + // the Sections. Realistically, the environments where this code path + // will be taken will not have eh_frame sections. unified_section_sp->SetFileAddress(load_cmd.vmaddr); - // Notify the module that the section addresses have been - // changed once we're done so any file-address caches can be - // updated. + // Notify the module that the section addresses have been changed once + // we're done so any file-address caches can be updated. context.FileAddressesChanged = true; } } @@ -1694,8 +1687,8 @@ struct section_64 sect64; ::memset(§64, 0, sizeof(sect64)); - // Push a section into our mach sections for the section at - // index zero (NO_SECT) if we don't have any mach sections yet... + // Push a section into our mach sections for the section at index zero + // (NO_SECT) if we don't have any mach sections yet... if (m_mach_sections.empty()) m_mach_sections.push_back(sect64); uint32_t segment_sect_idx; @@ -1716,8 +1709,8 @@ if (m_data.GetU32(&offset, §64.offset, num_u32s) == NULL) break; - // Keep a list of mach sections around in case we need to - // get at data that isn't stored in the abstracted Sections. + // Keep a list of mach sections around in case we need to get at data that + // isn't stored in the abstracted Sections. m_mach_sections.push_back(sect64); if (add_section) { @@ -1725,12 +1718,12 @@ sect64.sectname, std::min(strlen(sect64.sectname), sizeof(sect64.sectname))); if (!const_segname) { - // We have a segment with no name so we need to conjure up - // segments that correspond to the section's segname if there - // isn't already such a section. If there is such a section, we - // resize the section so that it spans all sections. We also - // mark these sections as fake so address matches don't hit if - // they land in the gaps between the child sections. + // We have a segment with no name so we need to conjure up segments + // that correspond to the section's segname if there isn't already such + // a section. If there is such a section, we resize the section so that + // it spans all sections. We also mark these sections as fake so + // address matches don't hit if they land in the gaps between the child + // sections. const_segname.SetTrimmedCStringWithLength(sect64.segname, sizeof(sect64.segname)); segment_sp = context.UnifiedList.FindSectionByName(const_segname); @@ -1750,9 +1743,8 @@ if (new_seg_byte_size > curr_seg_byte_size) segment->SetByteSize(new_seg_byte_size); } else { - // We need to change the base address of the segment and - // adjust the child section offsets for all existing - // children. + // We need to change the base address of the segment and adjust the + // child section offsets for all existing children. const lldb::addr_t slide_amount = sect64_min_addr - curr_seg_min_addr; segment->Slide(slide_amount, false); @@ -1905,9 +1897,9 @@ public: MachSymtabSectionInfo(SectionList *section_list) : m_section_list(section_list), m_section_infos() { - // Get the number of sections down to a depth of 1 to include - // all segments and their sections, but no other sections that - // may be added for debug map or + // Get the number of sections down to a depth of 1 to include all segments + // and their sections, but no other sections that may be added for debug + // map or m_section_infos.resize(section_list->GetNumSections(1)); } @@ -1935,9 +1927,9 @@ } else if (m_section_infos[n_sect].vm_range.GetByteSize() == 0 && m_section_infos[n_sect].vm_range.GetBaseAddress() == file_addr) { - // Symbol is in section with zero size, but has the same start - // address as the section. This can happen with linker symbols - // (symbols that start with the letter 'l' or 'L'. + // Symbol is in section with zero size, but has the same start address + // as the section. This can happen with linker symbols (symbols that + // start with the letter 'l' or 'L'. return m_section_infos[n_sect].section_sp; } } @@ -2251,10 +2243,9 @@ linkedit_section_sp->GetLoadBaseAddress(&target); if (linkedit_load_addr == LLDB_INVALID_ADDRESS) { // We might be trying to access the symbol table before the - // __LINKEDIT's load - // address has been set in the target. We can't fail to read the - // symbol table, - // so calculate the right address manually + // __LINKEDIT's load address has been set in the target. We can't + // fail to read the symbol table, so calculate the right address + // manually linkedit_load_addr = CalculateSectionLoadAddressForMemoryImage( m_memory_addr, GetMachHeaderSection(), linkedit_section_sp.get()); } @@ -2275,8 +2266,8 @@ process->GetAddressByteSize() == sizeof(void *)) { // This mach-o memory file is in the dyld shared cache. If this // program is not remote and this is iOS, then this process will - // share the same shared cache as the process we are debugging and - // we can read the entire __LINKEDIT from the address space in this + // share the same shared cache as the process we are debugging and we + // can read the entire __LINKEDIT from the address space in this // process. This is a needed optimization that is used for local iOS // debugging only since all shared libraries in the shared cache do // not have corresponding files that exist in the file system of the @@ -2285,10 +2276,9 @@ // string tables from all of the __LINKEDIT sections from the shared // libraries in the shared cache have been merged into a single large // symbol and string table. Reading all of this symbol and string - // table - // data across can slow down debug launch times, so we optimize this - // by - // reading the memory for the __LINKEDIT section from this process. + // table data across can slow down debug launch times, so we optimize + // this by reading the memory for the __LINKEDIT section from this + // process. UUID lldb_shared_cache(GetLLDBSharedCacheUUID()); UUID process_shared_cache(GetProcessSharedCacheUUID(process)); @@ -2324,10 +2314,9 @@ if (!data_was_read) { // Always load dyld - the dynamic linker - from memory if we didn't - // find a binary anywhere else. - // lldb will not register dylib/framework/bundle loads/unloads if we - // don't have the dyld symbols, - // we force dyld to load from memory despite the user's + // find a binary anywhere else. lldb will not register + // dylib/framework/bundle loads/unloads if we don't have the dyld + // symbols, we force dyld to load from memory despite the user's // target.memory-module-load-level setting. if (memory_module_load_level == eMemoryModuleLoadLevelComplete || m_header.filetype == llvm::MachO::MH_DYLINKER) { @@ -2337,10 +2326,9 @@ nlist_data.SetData(nlist_data_sp, 0, nlist_data_sp->GetByteSize()); // Load strings individually from memory when loading from memory - // since shared cache - // string tables contain strings for all symbols from all shared - // cached libraries - // DataBufferSP strtab_data_sp (ReadMemory (process_sp, strtab_addr, + // since shared cache string tables contain strings for all symbols + // from all shared cached libraries DataBufferSP strtab_data_sp + // (ReadMemory (process_sp, strtab_addr, // strtab_data_byte_size)); // if (strtab_data_sp) // strtab_data.SetData (strtab_data_sp, 0, @@ -2444,11 +2432,9 @@ const bool is_arm = (m_header.cputype == llvm::MachO::CPU_TYPE_ARM); // lldb works best if it knows the start address of all functions in a - // module. - // Linker symbols or debug info are normally the best source of information - // for start addr / size but - // they may be stripped in a released binary. - // Two additional sources of information exist in Mach-O binaries: + // module. Linker symbols or debug info are normally the best source of + // information for start addr / size but they may be stripped in a released + // binary. Two additional sources of information exist in Mach-O binaries: // LC_FUNCTION_STARTS - a list of ULEB128 encoded offsets of each // function's start address in the // binary, relative to the text section. @@ -2473,12 +2459,10 @@ } } else { // If m_type is eTypeDebugInfo, then this is a dSYM - it will have the - // load command claiming an eh_frame - // but it doesn't actually have the eh_frame content. And if we have a - // dSYM, we don't need to do any - // of this fill-in-the-missing-symbols works anyway - the debug info - // should give us all the functions in - // the module. + // load command claiming an eh_frame but it doesn't actually have the + // eh_frame content. And if we have a dSYM, we don't need to do any of + // this fill-in-the-missing-symbols works anyway - the debug info should + // give us all the functions in the module. if (text_section_sp.get() && eh_frame_section_sp.get() && m_type != eTypeDebugInfo) { DWARFCallFrameInfo eh_frame(*this, eh_frame_section_sp, @@ -2502,18 +2486,14 @@ const size_t function_starts_count = function_starts.GetSize(); // For user process binaries (executables, dylibs, frameworks, bundles), if - // we don't have - // LC_FUNCTION_STARTS/eh_frame section in this binary, we're going to assume - // the binary - // has been stripped. Don't allow assembly language instruction emulation - // because we don't - // know proper function start boundaries. + // we don't have LC_FUNCTION_STARTS/eh_frame section in this binary, we're + // going to assume the binary has been stripped. Don't allow assembly + // language instruction emulation because we don't know proper function + // start boundaries. // // For all other types of binaries (kernels, stand-alone bare board - // binaries, kexts), they - // may not have LC_FUNCTION_STARTS / eh_frame sections - we should not make - // any assumptions - // about them based on that. + // binaries, kexts), they may not have LC_FUNCTION_STARTS / eh_frame + // sections - we should not make any assumptions about them based on that. if (function_starts_count == 0 && CalculateStrata() == eStrataUser) { m_allow_assembly_emulation_unwind_plans = false; Log *unwind_or_symbol_log(lldb_private::GetLogIfAnyCategoriesSet( @@ -2545,8 +2525,8 @@ ValueToSymbolIndexMap N_FUN_addr_to_sym_idx; ValueToSymbolIndexMap N_STSYM_addr_to_sym_idx; ConstNameToSymbolIndexMap N_GSYM_name_to_sym_idx; - // Any symbols that get merged into another will get an entry - // in this map so we know + // Any symbols that get merged into another will get an entry in this map + // so we know NListIndexToSymbolIndexMap m_nlist_idx_to_sym_idx; uint32_t nlist_idx = 0; Symbol *symbol_ptr = NULL; @@ -2585,21 +2565,18 @@ (defined(__arm__) || defined(__arm64__) || defined(__aarch64__)) // Some recent builds of the dyld_shared_cache (hereafter: DSC) have been - // optimized by moving LOCAL - // symbols out of the memory mapped portion of the DSC. The symbol - // information has all been retained, - // but it isn't available in the normal nlist data. However, there *are* - // duplicate entries of *some* + // optimized by moving LOCAL symbols out of the memory mapped portion of + // the DSC. The symbol information has all been retained, but it isn't + // available in the normal nlist data. However, there *are* duplicate + // entries of *some* // LOCAL symbols in the normal nlist data. To handle this situation // correctly, we must first attempt // to parse any DSC unmapped symbol information. If we find any, we set a - // flag that tells the normal - // nlist parser to ignore all LOCAL symbols. + // flag that tells the normal nlist parser to ignore all LOCAL symbols. if (m_header.flags & 0x80000000u) { - // Before we can start mapping the DSC, we need to make certain the target - // process is actually - // using the cache we can find. + // Before we can start mapping the DSC, we need to make certain the + // target process is actually using the cache we can find. // Next we need to determine the correct path for the dyld shared cache. @@ -2633,9 +2610,9 @@ process_shared_cache_uuid = GetProcessSharedCacheUUID(process); } - // First see if we can find an exact match for the inferior process shared - // cache UUID in - // the development or non-development shared caches on disk. + // First see if we can find an exact match for the inferior process + // shared cache UUID in the development or non-development shared caches + // on disk. if (process_shared_cache_uuid.IsValid()) { if (dsc_development_filespec.Exists()) { UUID dsc_development_uuid = GetSharedCacheUUID( @@ -2700,8 +2677,7 @@ if (process_shared_cache_uuid.IsValid() && dsc_uuid != process_shared_cache_uuid) { // The on-disk dyld_shared_cache file is not the same as the one in - // this - // process' memory, don't use it. + // this process' memory, don't use it. uuid_match = false; ModuleSP module_sp(GetModule()); if (module_sp) @@ -2729,11 +2705,9 @@ offset = 0; // The File addresses (from the in-memory Mach-O load commands) for - // the shared libraries - // in the shared library cache need to be adjusted by an offset to - // match up with the - // dylibOffset identifying field in the - // dyld_cache_local_symbol_entry's. This offset is + // the shared libraries in the shared library cache need to be + // adjusted by an offset to match up with the dylibOffset identifying + // field in the dyld_cache_local_symbol_entry's. This offset is // recorded in mapping_offset_value. const uint64_t mapping_offset_value = dsc_mapping_info_data.GetU64(&offset); @@ -2827,8 +2801,8 @@ if (symbol_name == NULL) { // No symbol should be NULL, even the symbols with no - // string values should have an offset zero which points - // to an empty C-string + // string values should have an offset zero which + // points to an empty C-string Host::SystemLog( Host::eSystemLogError, "error: DSC unmapped local symbol[%u] has invalid " @@ -2863,14 +2837,13 @@ // FIXME: In the .o files, we have a GSYM and a debug // symbol for all the ObjC data. They // have the same address, but we want to ensure that - // we always find only the real symbol, - // 'cause we don't currently correctly attribute the + // we always find only the real symbol, 'cause we + // don't currently correctly attribute the // GSYM one to the ObjCClass/Ivar/MetaClass - // symbol type. This is a temporary hack to make sure - // the ObjectiveC symbols get treated - // correctly. To do this right, we should coalesce - // all the GSYM & global symbols that have the - // same address. + // symbol type. This is a temporary hack to make + // sure the ObjectiveC symbols get treated correctly. + // To do this right, we should coalesce all the GSYM + // & global symbols that have the same address. is_gsym = true; sym[sym_idx].SetExternal(true); @@ -2924,25 +2897,24 @@ N_FUN_addr_to_sym_idx.insert( std::make_pair(nlist.n_value, sym_idx)); // We use the current number of symbols in the - // symbol table in lieu of - // using nlist_idx in case we ever start trimming - // entries out + // symbol table in lieu of using nlist_idx in case + // we ever start trimming entries out N_FUN_indexes.push_back(sym_idx); } else { type = eSymbolTypeCompiler; if (!N_FUN_indexes.empty()) { - // Copy the size of the function into the original + // Copy the size of the function into the + // original // STAB entry so we don't have // to hunt for it later symtab->SymbolAtIndex(N_FUN_indexes.back()) ->SetByteSize(nlist.n_value); N_FUN_indexes.pop_back(); // We don't really need the end function STAB as - // it contains the size which - // we already placed with the original symbol, so - // don't add it if we want a - // minimal symbol table + // it contains the size which we already placed + // with the original symbol, so don't add it if + // we want a minimal symbol table add_nlist = false; } } @@ -2969,19 +2941,17 @@ case N_BNSYM: // We use the current number of symbols in the symbol - // table in lieu of - // using nlist_idx in case we ever start trimming - // entries out - // Skip these if we want minimal symbol tables + // table in lieu of using nlist_idx in case we ever + // start trimming entries out Skip these if we want + // minimal symbol tables add_nlist = false; break; case N_ENSYM: // Set the size of the N_BNSYM to the terminating - // index of this N_ENSYM - // so that we can always skip the entire symbol if we - // need to navigate - // more quickly at the source level when parsing STABS + // index of this N_ENSYM so that we can always skip + // the entire symbol if we need to navigate more + // quickly at the source level when parsing STABS // Skip these if we want minimal symbol tables add_nlist = false; break; @@ -3015,11 +2985,9 @@ add_nlist = false; if (N_SO_index != UINT32_MAX) { // Set the size of the N_SO to the terminating - // index of this N_SO - // so that we can always skip the entire N_SO if - // we need to navigate - // more quickly at the source level when parsing - // STABS + // index of this N_SO so that we can always skip + // the entire N_SO if we need to navigate more + // quickly at the source level when parsing STABS symbol_ptr = symtab->SymbolAtIndex(N_SO_index); symbol_ptr->SetByteSize(sym_idx); symbol_ptr->SetSizeIsSibling(true); @@ -3032,17 +3000,16 @@ N_SO_index = UINT32_MAX; } else { // We use the current number of symbols in the - // symbol table in lieu of - // using nlist_idx in case we ever start trimming - // entries out + // symbol table in lieu of using nlist_idx in case + // we ever start trimming entries out const bool N_SO_has_full_path = symbol_name[0] == '/'; if (N_SO_has_full_path) { if ((N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms)) { // We have two consecutive N_SO entries where - // the first contains a directory - // and the second contains a full path. + // the first contains a directory and the + // second contains a full path. sym[sym_idx - 1].GetMangled().SetValue( ConstString(symbol_name), false); m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1; @@ -3056,9 +3023,9 @@ } else if ((N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms)) { // This is usually the second N_SO entry that - // contains just the filename, - // so here we combine it with the first one if we - // are minimizing the symbol table + // contains just the filename, so here we combine + // it with the first one if we are minimizing the + // symbol table const char *so_path = sym[sym_idx - 1] .GetMangled() @@ -3072,11 +3039,11 @@ if (double_slash_pos != std::string::npos) { // The linker has been generating bad N_SO // entries with doubled up paths - // in the format "%s%s" where the first string - // in the DW_AT_comp_dir, - // and the second is the directory for the - // source file so you end up with - // a path that looks like "/tmp/src//tmp/src/" + // in the format "%s%s" where the first + // string in the DW_AT_comp_dir, and the + // second is the directory for the source + // file so you end up with a path that looks + // like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); if (!so_dir.Exists()) { so_dir.SetFile( @@ -3118,11 +3085,10 @@ // INCL scopes //---------------------------------------------------------------------- case N_BINCL: - // include file beginning: name,,NO_SECT,0,sum - // We use the current number of symbols in the symbol - // table in lieu of - // using nlist_idx in case we ever start trimming - // entries out + // include file beginning: name,,NO_SECT,0,sum We use + // the current number of symbols in the symbol table + // in lieu of using nlist_idx in case we ever start + // trimming entries out N_INCL_indexes.push_back(sym_idx); type = eSymbolTypeScopeBegin; break; @@ -3130,10 +3096,9 @@ case N_EINCL: // include file end: name,,NO_SECT,0,0 // Set the size of the N_BINCL to the terminating - // index of this N_EINCL - // so that we can always skip the entire symbol if we - // need to navigate - // more quickly at the source level when parsing STABS + // index of this N_EINCL so that we can always skip + // the entire symbol if we need to navigate more + // quickly at the source level when parsing STABS if (!N_INCL_indexes.empty()) { symbol_ptr = symtab->SymbolAtIndex(N_INCL_indexes.back()); @@ -3183,11 +3148,10 @@ // Left and Right Braces //---------------------------------------------------------------------- case N_LBRAC: - // left bracket: 0,,NO_SECT,nesting level,address - // We use the current number of symbols in the symbol - // table in lieu of - // using nlist_idx in case we ever start trimming - // entries out + // left bracket: 0,,NO_SECT,nesting level,address We + // use the current number of symbols in the symbol + // table in lieu of using nlist_idx in case we ever + // start trimming entries out symbol_section = section_info.GetSection( nlist.n_sect, nlist.n_value); N_BRAC_indexes.push_back(sym_idx); @@ -3197,10 +3161,9 @@ case N_RBRAC: // right bracket: 0,,NO_SECT,nesting level,address // Set the size of the N_LBRAC to the terminating - // index of this N_RBRAC - // so that we can always skip the entire symbol if we - // need to navigate - // more quickly at the source level when parsing STABS + // index of this N_RBRAC so that we can always skip + // the entire symbol if we need to navigate more + // quickly at the source level when parsing STABS symbol_section = section_info.GetSection( nlist.n_sect, nlist.n_value); if (!N_BRAC_indexes.empty()) { @@ -3224,9 +3187,8 @@ case N_BCOMM: // begin common: name,,NO_SECT,0,0 // We use the current number of symbols in the symbol - // table in lieu of - // using nlist_idx in case we ever start trimming - // entries out + // table in lieu of using nlist_idx in case we ever + // start trimming entries out type = eSymbolTypeScopeBegin; N_COMM_indexes.push_back(sym_idx); break; @@ -3240,10 +3202,10 @@ case N_ECOMM: // end common: name,,n_sect,0,0 // Set the size of the N_BCOMM to the terminating - // index of this N_ECOMM/N_ECOML - // so that we can always skip the entire symbol if we - // need to navigate - // more quickly at the source level when parsing STABS + // index of this N_ECOMM/N_ECOML so that we can + // always skip the entire symbol if we need to + // navigate more quickly at the source level when + // parsing STABS if (!N_COMM_indexes.empty()) { symbol_ptr = symtab->SymbolAtIndex(N_COMM_indexes.back()); @@ -3533,16 +3495,16 @@ function_starts_count > 0) { addr_t symbol_lookup_file_addr = nlist.n_value; // Do an exact address match for non-ARM addresses, - // else get the closest since - // the symbol might be a thumb symbol which has an - // address with bit zero set + // else get the closest since the symbol might be a + // thumb symbol which has an address with bit zero + // set FunctionStarts::Entry *func_start_entry = function_starts.FindEntry( symbol_lookup_file_addr, !is_arm); if (is_arm && func_start_entry) { // Verify that the function start address is the - // symbol address (ARM) - // or the symbol address + 1 (thumb) + // symbol address (ARM) or the symbol address + 1 + // (thumb) if (func_start_entry->addr != symbol_lookup_file_addr && func_start_entry->addr != @@ -3574,8 +3536,8 @@ addr_t next_symbol_file_addr = next_func_start_entry->addr; // Be sure the clear the Thumb address bit when - // we calculate the size - // from the current and next address + // we calculate the size from the current and + // next address if (is_arm) next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; @@ -3594,12 +3556,10 @@ if (is_debug == false) { if (type == eSymbolTypeCode) { // See if we can find a N_FUN entry for any code - // symbols. - // If we do find a match, and the name matches, then - // we - // can merge the two into just the function symbol - // to avoid - // duplicate entries in the symbol table + // symbols. If we do find a match, and the name + // matches, then we can merge the two into just the + // function symbol to avoid duplicate entries in + // the symbol table std::pair range; @@ -3647,12 +3607,10 @@ type == eSymbolTypeObjCMetaClass || type == eSymbolTypeObjCIVar) { // See if we can find a N_STSYM entry for any data - // symbols. - // If we do find a match, and the name matches, then - // we - // can merge the two into just the Static symbol to - // avoid - // duplicate entries in the symbol table + // symbols. If we do find a match, and the name + // matches, then we can merge the two into just the + // Static symbol to avoid duplicate entries in the + // symbol table std::pair range; @@ -3694,8 +3652,8 @@ Mangled::ePreferMangled) .GetCString(); if (gsym_name) { - // Combine N_GSYM stab entries with the non stab - // symbol + // Combine N_GSYM stab entries with the non + // stab symbol ConstNameToSymbolIndexMap::const_iterator pos = N_GSYM_name_to_sym_idx.find(gsym_name); if (pos != N_GSYM_name_to_sym_idx.end()) { @@ -3811,9 +3769,8 @@ symbol_name = strtab_data.PeekCStr(nlist.n_strx); if (symbol_name == NULL) { - // No symbol should be NULL, even the symbols with no - // string values should have an offset zero which points - // to an empty C-string + // No symbol should be NULL, even the symbols with no string values + // should have an offset zero which points to an empty C-string Host::SystemLog(Host::eSystemLogError, "error: symbol[%u] has invalid string table offset " "0x%x in %s, ignoring symbol\n", @@ -3852,14 +3809,12 @@ // FIXME: In the .o files, we have a GSYM and a debug symbol for all // the ObjC data. They // have the same address, but we want to ensure that we always find - // only the real symbol, - // 'cause we don't currently correctly attribute the GSYM one to the - // ObjCClass/Ivar/MetaClass - // symbol type. This is a temporary hack to make sure the - // ObjectiveC symbols get treated - // correctly. To do this right, we should coalesce all the GSYM & - // global symbols that have the - // same address. + // only the real symbol, 'cause we don't currently correctly + // attribute the GSYM one to the ObjCClass/Ivar/MetaClass symbol + // type. This is a temporary hack to make sure the ObjectiveC + // symbols get treated correctly. To do this right, we should + // coalesce all the GSYM & global symbols that have the same + // address. is_gsym = true; sym[sym_idx].SetExternal(true); @@ -3906,24 +3861,21 @@ N_FUN_addr_to_sym_idx.insert( std::make_pair(nlist.n_value, sym_idx)); // We use the current number of symbols in the symbol table in - // lieu of - // using nlist_idx in case we ever start trimming entries out + // lieu of using nlist_idx in case we ever start trimming entries + // out N_FUN_indexes.push_back(sym_idx); } else { type = eSymbolTypeCompiler; if (!N_FUN_indexes.empty()) { - // Copy the size of the function into the original STAB entry so - // we don't have - // to hunt for it later + // Copy the size of the function into the original STAB entry + // so we don't have to hunt for it later symtab->SymbolAtIndex(N_FUN_indexes.back()) ->SetByteSize(nlist.n_value); N_FUN_indexes.pop_back(); - // We don't really need the end function STAB as it contains the - // size which - // we already placed with the original symbol, so don't add it - // if we want a - // minimal symbol table + // We don't really need the end function STAB as it contains + // the size which we already placed with the original symbol, + // so don't add it if we want a minimal symbol table add_nlist = false; } } @@ -3950,18 +3902,15 @@ case N_BNSYM: // We use the current number of symbols in the symbol table in lieu - // of - // using nlist_idx in case we ever start trimming entries out + // of using nlist_idx in case we ever start trimming entries out // Skip these if we want minimal symbol tables add_nlist = false; break; case N_ENSYM: // Set the size of the N_BNSYM to the terminating index of this - // N_ENSYM - // so that we can always skip the entire symbol if we need to - // navigate - // more quickly at the source level when parsing STABS + // N_ENSYM so that we can always skip the entire symbol if we need + // to navigate more quickly at the source level when parsing STABS // Skip these if we want minimal symbol tables add_nlist = false; break; @@ -3995,10 +3944,9 @@ add_nlist = false; if (N_SO_index != UINT32_MAX) { // Set the size of the N_SO to the terminating index of this - // N_SO - // so that we can always skip the entire N_SO if we need to - // navigate - // more quickly at the source level when parsing STABS + // N_SO so that we can always skip the entire N_SO if we need + // to navigate more quickly at the source level when parsing + // STABS symbol_ptr = symtab->SymbolAtIndex(N_SO_index); symbol_ptr->SetByteSize(sym_idx); symbol_ptr->SetSizeIsSibling(true); @@ -4011,30 +3959,27 @@ N_SO_index = UINT32_MAX; } else { // We use the current number of symbols in the symbol table in - // lieu of - // using nlist_idx in case we ever start trimming entries out + // lieu of using nlist_idx in case we ever start trimming entries + // out const bool N_SO_has_full_path = symbol_name[0] == '/'; if (N_SO_has_full_path) { if ((N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms)) { // We have two consecutive N_SO entries where the first - // contains a directory - // and the second contains a full path. + // contains a directory and the second contains a full path. sym[sym_idx - 1].GetMangled().SetValue( ConstString(symbol_name), false); m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1; add_nlist = false; } else { - // This is the first entry in a N_SO that contains a directory - // or - // a full path to the source file + // This is the first entry in a N_SO that contains a + // directory or a full path to the source file N_SO_index = sym_idx; } } else if ((N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms)) { // This is usually the second N_SO entry that contains just the - // filename, - // so here we combine it with the first one if we are minimizing - // the symbol table + // filename, so here we combine it with the first one if we are + // minimizing the symbol table const char *so_path = sym[sym_idx - 1] .GetMangled() @@ -4045,12 +3990,10 @@ const size_t double_slash_pos = full_so_path.find("//"); if (double_slash_pos != std::string::npos) { // The linker has been generating bad N_SO entries with - // doubled up paths - // in the format "%s%s" where the first string in the - // DW_AT_comp_dir, - // and the second is the directory for the source file so - // you end up with - // a path that looks like "/tmp/src//tmp/src/" + // doubled up paths in the format "%s%s" where the first + // string in the DW_AT_comp_dir, and the second is the + // directory for the source file so you end up with a path + // that looks like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); if (!so_dir.Exists()) { so_dir.SetFile(&full_so_path[double_slash_pos + 1], @@ -4090,10 +4033,9 @@ // INCL scopes //---------------------------------------------------------------------- case N_BINCL: - // include file beginning: name,,NO_SECT,0,sum - // We use the current number of symbols in the symbol table in lieu - // of - // using nlist_idx in case we ever start trimming entries out + // include file beginning: name,,NO_SECT,0,sum We use the current + // number of symbols in the symbol table in lieu of using nlist_idx + // in case we ever start trimming entries out N_INCL_indexes.push_back(sym_idx); type = eSymbolTypeScopeBegin; break; @@ -4101,10 +4043,8 @@ case N_EINCL: // include file end: name,,NO_SECT,0,0 // Set the size of the N_BINCL to the terminating index of this - // N_EINCL - // so that we can always skip the entire symbol if we need to - // navigate - // more quickly at the source level when parsing STABS + // N_EINCL so that we can always skip the entire symbol if we need + // to navigate more quickly at the source level when parsing STABS if (!N_INCL_indexes.empty()) { symbol_ptr = symtab->SymbolAtIndex(N_INCL_indexes.back()); symbol_ptr->SetByteSize(sym_idx + 1); @@ -4153,10 +4093,9 @@ // Left and Right Braces //---------------------------------------------------------------------- case N_LBRAC: - // left bracket: 0,,NO_SECT,nesting level,address - // We use the current number of symbols in the symbol table in lieu - // of - // using nlist_idx in case we ever start trimming entries out + // left bracket: 0,,NO_SECT,nesting level,address We use the + // current number of symbols in the symbol table in lieu of using + // nlist_idx in case we ever start trimming entries out symbol_section = section_info.GetSection(nlist.n_sect, nlist.n_value); N_BRAC_indexes.push_back(sym_idx); @@ -4164,12 +4103,10 @@ break; case N_RBRAC: - // right bracket: 0,,NO_SECT,nesting level,address - // Set the size of the N_LBRAC to the terminating index of this - // N_RBRAC - // so that we can always skip the entire symbol if we need to - // navigate - // more quickly at the source level when parsing STABS + // right bracket: 0,,NO_SECT,nesting level,address Set the size of + // the N_LBRAC to the terminating index of this N_RBRAC so that we + // can always skip the entire symbol if we need to navigate more + // quickly at the source level when parsing STABS symbol_section = section_info.GetSection(nlist.n_sect, nlist.n_value); if (!N_BRAC_indexes.empty()) { @@ -4192,8 +4129,7 @@ case N_BCOMM: // begin common: name,,NO_SECT,0,0 // We use the current number of symbols in the symbol table in lieu - // of - // using nlist_idx in case we ever start trimming entries out + // of using nlist_idx in case we ever start trimming entries out type = eSymbolTypeScopeBegin; N_COMM_indexes.push_back(sym_idx); break; @@ -4207,10 +4143,9 @@ case N_ECOMM: // end common: name,,n_sect,0,0 // Set the size of the N_BCOMM to the terminating index of this - // N_ECOMM/N_ECOML - // so that we can always skip the entire symbol if we need to - // navigate - // more quickly at the source level when parsing STABS + // N_ECOMM/N_ECOML so that we can always skip the entire symbol if + // we need to navigate more quickly at the source level when + // parsing STABS if (!N_COMM_indexes.empty()) { symbol_ptr = symtab->SymbolAtIndex(N_COMM_indexes.back()); symbol_ptr->SetByteSize(sym_idx + 1); @@ -4470,15 +4405,13 @@ if (symbol_byte_size == 0 && function_starts_count > 0) { addr_t symbol_lookup_file_addr = nlist.n_value; // Do an exact address match for non-ARM addresses, else get the - // closest since - // the symbol might be a thumb symbol which has an address with - // bit zero set + // closest since the symbol might be a thumb symbol which has an + // address with bit zero set FunctionStarts::Entry *func_start_entry = function_starts.FindEntry(symbol_lookup_file_addr, !is_arm); if (is_arm && func_start_entry) { // Verify that the function start address is the symbol address - // (ARM) - // or the symbol address + 1 (thumb) + // (ARM) or the symbol address + 1 (thumb) if (func_start_entry->addr != symbol_lookup_file_addr && func_start_entry->addr != (symbol_lookup_file_addr + 1)) { // Not the right entry, NULL it out... @@ -4499,8 +4432,7 @@ if (next_func_start_entry) { addr_t next_symbol_file_addr = next_func_start_entry->addr; // Be sure the clear the Thumb address bit when we calculate - // the size - // from the current and next address + // the size from the current and next address if (is_arm) next_symbol_file_addr &= THUMB_ADDRESS_BIT_MASK; symbol_byte_size = std::min( @@ -4516,10 +4448,10 @@ if (is_debug == false) { if (type == eSymbolTypeCode) { - // See if we can find a N_FUN entry for any code symbols. - // If we do find a match, and the name matches, then we - // can merge the two into just the function symbol to avoid - // duplicate entries in the symbol table + // See if we can find a N_FUN entry for any code symbols. If we + // do find a match, and the name matches, then we can merge the + // two into just the function symbol to avoid duplicate entries + // in the symbol table std::pair range; @@ -4536,9 +4468,8 @@ Mangled::ePreferMangled)) { m_nlist_idx_to_sym_idx[nlist_idx] = pos->second; // We just need the flags from the linker symbol, so put - // these flags - // into the N_FUN flags to avoid duplicate symbols in the - // symbol table + // these flags into the N_FUN flags to avoid duplicate + // symbols in the symbol table sym[pos->second].SetExternal(sym[sym_idx].IsExternal()); sym[pos->second].SetFlags(nlist.n_type << 16 | nlist.n_desc); @@ -4561,10 +4492,10 @@ type == eSymbolTypeObjCClass || type == eSymbolTypeObjCMetaClass || type == eSymbolTypeObjCIVar) { - // See if we can find a N_STSYM entry for any data symbols. - // If we do find a match, and the name matches, then we - // can merge the two into just the Static symbol to avoid - // duplicate entries in the symbol table + // See if we can find a N_STSYM entry for any data symbols. If we + // do find a match, and the name matches, then we can merge the + // two into just the Static symbol to avoid duplicate entries in + // the symbol table std::pair range; @@ -4581,9 +4512,8 @@ Mangled::ePreferMangled)) { m_nlist_idx_to_sym_idx[nlist_idx] = pos->second; // We just need the flags from the linker symbol, so put - // these flags - // into the N_STSYM flags to avoid duplicate symbols in the - // symbol table + // these flags into the N_STSYM flags to avoid duplicate + // symbols in the symbol table sym[pos->second].SetExternal(sym[sym_idx].IsExternal()); sym[pos->second].SetFlags(nlist.n_type << 16 | nlist.n_desc); @@ -4607,16 +4537,15 @@ if (pos != N_GSYM_name_to_sym_idx.end()) { const uint32_t GSYM_sym_idx = pos->second; m_nlist_idx_to_sym_idx[nlist_idx] = GSYM_sym_idx; - // Copy the address, because often the N_GSYM address has an - // invalid address of zero - // when the global is a common symbol + // Copy the address, because often the N_GSYM address has + // an invalid address of zero when the global is a common + // symbol sym[GSYM_sym_idx].GetAddressRef().SetSection( symbol_section); sym[GSYM_sym_idx].GetAddressRef().SetOffset(symbol_value); // We just need the flags from the linker symbol, so put - // these flags - // into the N_GSYM flags to avoid duplicate symbols in the - // symbol table + // these flags into the N_GSYM flags to avoid duplicate + // symbols in the symbol table sym[GSYM_sym_idx].SetFlags(nlist.n_type << 16 | nlist.n_desc); sym[sym_idx].Clear(); @@ -4723,8 +4652,8 @@ } } - // Trim our symbols down to just what we ended up with after - // removing any symbols. + // Trim our symbols down to just what we ended up with after removing any + // symbols. if (sym_idx < num_syms) { num_syms = sym_idx; sym = symtab->Resize(num_syms); @@ -4772,13 +4701,12 @@ m_nlist_idx_to_sym_idx.find(stub_sym_id); Symbol *stub_symbol = NULL; if (index_pos != end_index_pos) { - // We have a remapping from the original nlist index to - // a current symbol index, so just look this up by index + // We have a remapping from the original nlist index to a + // current symbol index, so just look this up by index stub_symbol = symtab->SymbolAtIndex(index_pos->second); } else { - // We need to lookup a symbol using the original nlist - // symbol index since this index is coming from the - // S_SYMBOL_STUBS + // We need to lookup a symbol using the original nlist symbol + // index since this index is coming from the S_SYMBOL_STUBS stub_symbol = symtab->FindSymbolByID(stub_sym_id); } @@ -4787,12 +4715,9 @@ if (stub_symbol->GetType() == eSymbolTypeUndefined) { // Change the external symbol into a trampoline that makes - // sense - // These symbols were N_UNDF N_EXT, and are useless to us, - // so we - // can re-use them so we don't have to make up a synthetic - // symbol - // for no good reason. + // sense These symbols were N_UNDF N_EXT, and are useless + // to us, so we can re-use them so we don't have to make up + // a synthetic symbol for no good reason. if (resolver_addresses.find(symbol_stub_addr) == resolver_addresses.end()) stub_symbol->SetType(eSymbolTypeTrampoline); @@ -4837,8 +4762,8 @@ if (!trie_entries.empty()) { for (const auto &e : trie_entries) { if (e.entry.import_name) { - // Only add indirect symbols from the Trie entries if we - // didn't have a N_INDR nlist entry for this already + // Only add indirect symbols from the Trie entries if we didn't have + // a N_INDR nlist entry for this already if (indirect_symbol_names.find(e.entry.name) == indirect_symbol_names.end()) { // Make a synthetic symbol to describe re-exported symbol. @@ -4952,16 +4877,16 @@ if (header.filetype == MH_PRELOAD) { if (header.cputype == CPU_TYPE_ARM) { - // If this is a 32-bit arm binary, and it's a standalone binary, - // force the Vendor to Apple so we don't accidentally pick up - // the generic armv7 ABI at runtime. Apple's armv7 ABI always uses - // r7 for the frame pointer register; most other armv7 ABIs use a - // combination of r7 and r11. + // If this is a 32-bit arm binary, and it's a standalone binary, force + // the Vendor to Apple so we don't accidentally pick up the generic + // armv7 ABI at runtime. Apple's armv7 ABI always uses r7 for the + // frame pointer register; most other armv7 ABIs use a combination of + // r7 and r11. triple.setVendor(llvm::Triple::Apple); } else { // Set vendor to an unspecified unknown or a "*" so it can match any - // vendor - // This is required for correct behavior of EFI debugging on x86_64 + // vendor This is required for correct behavior of EFI debugging on + // x86_64 triple.setVendor(llvm::Triple::UnknownVendor); triple.setVendorName(llvm::StringRef()); } @@ -5032,7 +4957,8 @@ std::vector rpath_relative_paths; std::vector at_exec_relative_paths; const bool resolve_path = false; // Don't resolve the dependent file paths - // since they may not reside on this system + // since they may not reside on this + // system uint32_t i; for (i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; @@ -5096,8 +5022,8 @@ for (const auto &rpath : rpath_paths) { std::string path = rpath; path += rpath_relative_path; - // It is OK to resolve this path because we must find a file on - // disk for us to accept it anyway if it is rpath relative. + // It is OK to resolve this path because we must find a file on disk + // for us to accept it anyway if it is rpath relative. FileSpec file_spec(path, true); if (file_spec.Exists() && files.AppendIfUnique(file_spec)) { count++; @@ -5126,17 +5052,15 @@ lldb_private::Address ObjectFileMachO::GetEntryPointAddress() { // If the object file is not an executable it can't hold the entry point. - // m_entry_point_address - // is initialized to an invalid address, so we can just return that. - // If m_entry_point_address is valid it means we've found it already, so - // return the cached value. + // m_entry_point_address is initialized to an invalid address, so we can just + // return that. If m_entry_point_address is valid it means we've found it + // already, so return the cached value. if (!IsExecutable() || m_entry_point_address.IsValid()) return m_entry_point_address; // Otherwise, look for the UnixThread or Thread command. The data for the - // Thread command is given in - // /usr/include/mach-o.h, but it is basically: + // Thread command is given in /usr/include/mach-o.h, but it is basically: // // uint32_t flavor - this is the flavor argument you would pass to // thread_get_state @@ -5150,9 +5074,9 @@ // FIXME: We will need to have a "RegisterContext data provider" class at some // point that can get all the registers // out of data in this form & attach them to a given thread. That should - // underlie the MacOS X User process plugin, - // and we'll also need it for the MacOS X Core File process plugin. When we - // have that we can also use it here. + // underlie the MacOS X User process plugin, and we'll also need it for the + // MacOS X Core File process plugin. When we have that we can also use it + // here. // // For now we hard-code the offsets and flavors we need: // @@ -5257,16 +5181,14 @@ if (start_address != LLDB_INVALID_ADDRESS) { // We got the start address from the load commands, so now resolve that - // address in the sections - // of this ObjectFile: + // address in the sections of this ObjectFile: if (!m_entry_point_address.ResolveAddressUsingFileSections( start_address, GetSectionList())) { m_entry_point_address.Clear(); } } else { // We couldn't read the UnixThread load command - maybe it wasn't there. - // As a fallback look for the - // "start" symbol in the main executable. + // As a fallback look for the "start" symbol in the main executable. ModuleSP module_sp(GetModule()); @@ -5331,8 +5253,8 @@ if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - // First, look over the load commands for an LC_NOTE load command - // with data_owner string "kern ver str" & use that if found. + // First, look over the load commands for an LC_NOTE load command with + // data_owner string "kern ver str" & use that if found. lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; @@ -5348,8 +5270,8 @@ uint64_t fileoff = m_data.GetU64_unchecked (&offset); uint64_t size = m_data.GetU64_unchecked (&offset); - // "kern ver str" has a uint32_t version and then a - // nul terminated c-string. + // "kern ver str" has a uint32_t version and then a nul terminated + // c-string. if (strcmp ("kern ver str", data_owner) == 0) { offset = fileoff; @@ -5376,8 +5298,8 @@ offset = cmd_offset + lc.cmdsize; } - // Second, make a pass over the load commands looking for an - // obsolete LC_IDENT load command. + // Second, make a pass over the load commands looking for an obsolete + // LC_IDENT load command. offset = MachHeaderSizeFromMagic(m_header.magic); for (uint32_t i = 0; i < m_header.ncmds; ++i) { const uint32_t cmd_offset = offset; @@ -5422,7 +5344,8 @@ uint64_t fileoff = m_data.GetU64_unchecked (&offset); uint64_t size = m_data.GetU64_unchecked (&offset); - // "main bin spec" (main binary specification) data payload is formatted: + // "main bin spec" (main binary specification) data payload is + // formatted: // uint32_t version [currently 1] // uint32_t type [0 == unspecified, 1 == kernel, 2 == user process] // uint64_t address [ UINT64_MAX if address not specified ] @@ -5503,9 +5426,9 @@ // UUID load command. UUID uuid; if (GetUUID(&uuid)) { - // this checking for the UUID load command is not enough - // we could eventually look for the symbol named - // "OSKextGetCurrentIdentifier" as this is required of kexts + // this checking for the UUID load command is not enough we could + // eventually look for the symbol named "OSKextGetCurrentIdentifier" as + // this is required of kexts if (m_strata == eStrataInvalid) m_strata = eStrataKernel; return eTypeSharedLibrary; @@ -5547,9 +5470,9 @@ // UUID load command. UUID uuid; if (GetUUID(&uuid)) { - // this checking for the UUID load command is not enough - // we could eventually look for the symbol named - // "OSKextGetCurrentIdentifier" as this is required of kexts + // this checking for the UUID load command is not enough we could + // eventually look for the symbol named "OSKextGetCurrentIdentifier" as + // this is required of kexts if (m_type == eTypeInvalid) m_type = eTypeSharedLibrary; @@ -5636,8 +5559,8 @@ for (i = 3; i < num_versions; ++i) versions[i] = UINT32_MAX; } - // The LC_ID_DYLIB load command has a version with 3 version numbers - // in it, so always return 3 + // The LC_ID_DYLIB load command has a version with 3 version numbers in + // it, so always return 3 return 3; } } @@ -5837,9 +5760,9 @@ uint32_t ObjectFileMachO::GetPluginVersion() { return 1; } Section *ObjectFileMachO::GetMachHeaderSection() { - // Find the first address of the mach header which is the first non-zero - // file sized section whose file offset is zero. This is the base file address - // of the mach-o file which can be subtracted from the vmaddr of the other + // Find the first address of the mach header which is the first non-zero file + // sized section whose file offset is zero. This is the base file address of + // the mach-o file which can be subtracted from the vmaddr of the other // segments found in memory and added to the load address ModuleSP module_sp = GetModule(); if (module_sp) { @@ -5877,8 +5800,8 @@ module_sp.get() == section->GetModule().get()) { // Ignore __LINKEDIT and __DWARF segments if (section->GetName() == GetSegmentNameLINKEDIT()) { - // Only map __LINKEDIT if we have an in memory image and this isn't - // a kernel binary like a kext or mach_kernel. + // Only map __LINKEDIT if we have an in memory image and this isn't a + // kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); if (is_memory_image == false || strata == eStrataKernel) @@ -5904,9 +5827,8 @@ if (value_is_offset) { // "value" is an offset to apply to each top level segment for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) { - // Iterate through the object file sections to find all - // of the sections that size on disk (to avoid __PAGEZERO) - // and load them + // Iterate through the object file sections to find all of the + // sections that size on disk (to avoid __PAGEZERO) and load them SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && section_sp->GetFileSize() > 0 && section_sp->IsThreadSpecific() == false && @@ -5914,8 +5836,7 @@ // Ignore __LINKEDIT and __DWARF segments if (section_sp->GetName() == GetSegmentNameLINKEDIT()) { // Only map __LINKEDIT if we have an in memory image and this - // isn't - // a kernel binary like a kext or mach_kernel. + // isn't a kernel binary like a kext or mach_kernel. const bool is_memory_image = (bool)m_process_wp.lock(); const Strata strata = GetStrata(); if (is_memory_image == false || strata == eStrataKernel) @@ -6065,10 +5986,10 @@ ThreadList &thread_list = process_sp->GetThreadList(); const uint32_t num_threads = thread_list.GetSize(); - // Make an array of LC_THREAD data items. Each one contains - // the contents of the LC_THREAD load command. The data doesn't - // contain the load command + load command size, we will - // add the load command and load command size as we emit the data. + // Make an array of LC_THREAD data items. Each one contains the + // contents of the LC_THREAD load command. The data doesn't contain + // the load command + load command size, we will add the load command + // and load command size as we emit the data. std::vector LC_THREAD_datas(num_threads); for (auto &LC_THREAD_data : LC_THREAD_datas) { LC_THREAD_data.GetFlags().Set(Stream::eBinary); @@ -6228,8 +6149,8 @@ bytes_left -= bytes_read; addr += bytes_read; } else { - // Some pages within regions are not readable, those - // should be zero filled + // Some pages within regions are not readable, those should + // be zero filled memset(bytes, 0, bytes_to_read); size_t bytes_written = bytes_to_read; error = core_file.Write(bytes, bytes_written); Index: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp =================================================================== --- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -236,8 +236,8 @@ size_t sect_idx = 0; for (sect_idx = 0; sect_idx < num_sections; ++sect_idx) { - // Iterate through the object file sections to find all - // of the sections that have SHF_ALLOC in their flag bits. + // Iterate through the object file sections to find all of the sections + // that have SHF_ALLOC in their flag bits. SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx)); if (section_sp && !section_sp->IsThreadSpecific()) { if (target.GetSectionLoadList().SetSectionLoadAddress( @@ -268,8 +268,8 @@ //---------------------------------------------------------------------- // NeedsEndianSwap // -// Return true if an endian swap needs to occur when extracting data -// from this file. +// Return true if an endian swap needs to occur when extracting data from this +// file. //---------------------------------------------------------------------- bool ObjectFilePECOFF::NeedsEndianSwap() const { #if defined(__LITTLE_ENDIAN__) @@ -552,8 +552,8 @@ // are followed by a 4-byte string table offset. Else these // 8 bytes contain the symbol name if (symtab_data.GetU32(&offset) == 0) { - // Long string that doesn't fit into the symbol table name, - // so now we must read the 4 byte string table offset + // Long string that doesn't fit into the symbol table name, so + // now we must read the 4 byte string table offset uint32_t strtab_offset = symtab_data.GetU32(&offset); symbol_name_cstr = strtab_data.PeekCStr(strtab_offset); symbol_name.assign(symbol_name_cstr); Index: lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp =================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp +++ lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp @@ -312,8 +312,8 @@ } std::vector goroutines; // The threads that are in "new_thread_list" upon entry are the threads from - // the - // lldb_private::Process subclass, no memory threads will be in this list. + // the lldb_private::Process subclass, no memory threads will be in this + // list. Status err; for (uint64_t i = 0; i < allglen; ++i) { Index: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp =================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -50,8 +50,8 @@ OperatingSystem *OperatingSystemPython::CreateInstance(Process *process, bool force) { - // Python OperatingSystem plug-ins must be requested by name, so force must be - // true + // Python OperatingSystem plug-ins must be requested by name, so force must + // be true FileSpec python_os_plugin_spec(process->GetPythonOSPluginPath()); if (python_os_plugin_spec && python_os_plugin_spec.Exists()) { std::unique_ptr os_ap( @@ -186,8 +186,8 @@ const uint32_t num_cores = core_thread_list.GetSize(false); // Make a map so we can keep track of which cores were used from the - // core_thread list. Any real threads/cores that weren't used should - // later be put back into the "new_thread_list". + // core_thread list. Any real threads/cores that weren't used should later be + // put back into the "new_thread_list". std::vector core_used_map(num_cores, false); if (threads_list) { if (log) { @@ -212,8 +212,7 @@ // Any real core threads that didn't end up backing a memory thread should // still be in the main thread list, and they should be inserted at the - // beginning - // of the list + // beginning of the list uint32_t insert_idx = 0; for (uint32_t core_idx = 0; core_idx < num_cores; ++core_idx) { if (core_used_map[core_idx] == false) { @@ -254,8 +253,8 @@ // plug-in generated thread. if (!IsOperatingSystemPluginThread(thread_sp)) { // We have thread ID overlap between the protocol threads and the - // operating system threads, clear the thread so we create an - // operating system thread for this. + // operating system threads, clear the thread so we create an operating + // system thread for this. thread_sp.reset(); } } @@ -328,8 +327,8 @@ reg_ctx_sp.reset(new RegisterContextMemory( *thread, 0, *GetDynamicRegisterInfo(), reg_data_addr)); } else { - // No register data address is provided, query the python plug-in to let - // it make up the data as it sees fit + // No register data address is provided, query the python plug-in to let it + // make up the data as it sees fit if (log) log->Printf("OperatingSystemPython::CreateRegisterContextForThread (tid " "= 0x%" PRIx64 ", 0x%" PRIx64 Index: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp +++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp @@ -165,8 +165,8 @@ for (const auto device : devices) device_list.push_back(device.split('\t').first); - // Force disconnect since ADB closes connection after host:devices - // response is sent. + // Force disconnect since ADB closes connection after host:devices response + // is sent. m_conn.reset(); return error; } Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -83,9 +83,9 @@ break; #if defined(__ANDROID__) - // Only accept "unknown" for the vendor if the host is android and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified_ + // Only accept "unknown" for the vendor if the host is android and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified_ case llvm::Triple::VendorType::UnknownVendor: create = !arch->TripleVendorWasSpecified(); break; @@ -100,9 +100,9 @@ break; #if defined(__ANDROID__) - // Only accept "unknown" for the OS if the host is android and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is android and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::OSType::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -222,8 +222,8 @@ if (strchr(source_file, '\'') != nullptr) return Status("Doesn't support single-quotes in filenames"); - // mode == 0 can signify that adbd cannot access the file - // due security constraints - try "cat ..." as a fallback. + // mode == 0 can signify that adbd cannot access the file due security + // constraints - try "cat ..." as a fallback. AdbClient adb(m_device_id); char cmd[PATH_MAX]; Index: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp +++ lldb/trunk/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.cpp @@ -180,9 +180,9 @@ static const int kAttempsNum = 5; Status error; - // There is a race possibility that somebody will occupy - // a port while we're in between FindUnusedPort and ForwardPortWithAdb - - // adding the loop to mitigate such problem. + // There is a race possibility that somebody will occupy a port while we're + // in between FindUnusedPort and ForwardPortWithAdb - adding the loop to + // mitigate such problem. for (auto i = 0; i < kAttempsNum; ++i) { uint16_t local_port = 0; error = FindUnusedPort(local_port); @@ -208,10 +208,9 @@ lldb_private::Debugger &debugger, lldb_private::Target *target, lldb_private::Status &error) { // We don't have the pid of the remote gdbserver when it isn't started by us - // but we still want - // to store the list of port forwards we set up in our port forward map. - // Generate a fake pid for - // these cases what won't collide with any other valid pid on android. + // but we still want to store the list of port forwards we set up in our port + // forward map. Generate a fake pid for these cases what won't collide with + // any other valid pid on android. static lldb::pid_t s_remote_gdbserver_fake_pid = 0xffffffffffffffffULL; int remote_port; Index: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -32,8 +32,8 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" -// Define these constants from FreeBSD mman.h for use when targeting -// remote FreeBSD systems even when host has different values. +// Define these constants from FreeBSD mman.h for use when targeting remote +// FreeBSD systems even when host has different values. #define MAP_PRIVATE 0x0002 #define MAP_ANON 0x1000 @@ -60,9 +60,8 @@ break; #if defined(__FreeBSD__) - // Only accept "unknown" for the OS if the host is BSD and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is BSD and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::OSType::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -143,7 +142,8 @@ arch = hostArch; return arch.IsValid(); } else if (idx == 1) { - // If the default host architecture is 64-bit, look for a 32-bit variant + // If the default host architecture is 64-bit, look for a 32-bit + // variant if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) { arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); @@ -187,13 +187,10 @@ return false; } // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the - // vendor by - // calling triple.SetVendorName("unknown") so that it is a "unspecified - // unknown". - // This means when someone calls triple.GetVendorName() it will return an - // empty string - // which indicates that the vendor can be set when two architectures are - // merged + // vendor by calling triple.SetVendorName("unknown") so that it is a + // "unspecified unknown". This means when someone calls + // triple.GetVendorName() it will return an empty string which indicates + // that the vendor can be set when two architectures are merged // Now set the triple into "arch" and return true arch.SetTriple(triple); @@ -286,9 +283,9 @@ if (target && error.Success()) { debugger.GetTargetList().SetSelectedTarget(target); - // The freebsd always currently uses the GDB remote debugger plug-in - // so even when debugging locally we are debugging remotely! - // Just like the darwin plugin. + // The freebsd always currently uses the GDB remote debugger plug-in so + // even when debugging locally we are debugging remotely! Just like the + // darwin plugin. process_sp = target->CreateProcess( attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL); Index: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -30,8 +30,8 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" -// Define these constants from Linux mman.h for use when targeting -// remote linux systems even when host has different values. +// Define these constants from Linux mman.h for use when targeting remote linux +// systems even when host has different values. #define MAP_PRIVATE 2 #define MAP_ANON 0x20 @@ -58,9 +58,8 @@ break; #if defined(__linux__) - // Only accept "unknown" for the OS if the host is linux and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is linux and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::OSType::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -142,7 +141,8 @@ arch = hostArch; return arch.IsValid(); } else if (idx == 1) { - // If the default host architecture is 64-bit, look for a 32-bit variant + // If the default host architecture is 64-bit, look for a 32-bit + // variant if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) { arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); @@ -192,13 +192,10 @@ return false; } // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the - // vendor by - // calling triple.SetVendorName("unknown") so that it is a "unspecified - // unknown". - // This means when someone calls triple.GetVendorName() it will return an - // empty string - // which indicates that the vendor can be set when two architectures are - // merged + // vendor by calling triple.SetVendorName("unknown") so that it is a + // "unspecified unknown". This means when someone calls + // triple.GetVendorName() it will return an empty string which indicates + // that the vendor can be set when two architectures are merged // Now set the triple into "arch" and return true arch.SetTriple(triple); @@ -212,8 +209,8 @@ #ifndef LLDB_DISABLE_POSIX // Display local kernel information only when we are running in host mode. - // Otherwise, we would end up printing non-Linux information (when running - // on Mac OS for example). + // Otherwise, we would end up printing non-Linux information (when running on + // Mac OS for example). if (IsHost()) { struct utsname un; @@ -272,8 +269,8 @@ } // For local debugging, Linux will override the debug logic to use llgs-launch -// rather than lldb-launch, llgs-attach. This differs from current lldb-launch, -// debugserver-attach approach on MacOSX. +// rather than lldb-launch, llgs-attach. This differs from current lldb- +// launch, debugserver-attach approach on MacOSX. lldb::ProcessSP PlatformLinux::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new @@ -297,8 +294,8 @@ launch_info.GetFlags().Set(eLaunchFlagDebug); // We always launch the process we are going to debug in a separate process - // group, since then we can handle ^C interrupts ourselves w/o having to worry - // about the target getting them as well. + // group, since then we can handle ^C interrupts ourselves w/o having to + // worry about the target getting them as well. launch_info.SetLaunchInSeparateProcessGroup(true); // Ensure we have a target. Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -84,8 +84,8 @@ void PlatformAppleSimulator::GetStatus(Stream &strm) { #if defined(__APPLE__) - // This will get called by subclasses, so just output status on the - // current simulator + // This will get called by subclasses, so just output status on the current + // simulator PlatformAppleSimulator::LoadCoreSimulator(); CoreSimulatorSupport::DeviceSet devices = @@ -183,8 +183,8 @@ // Make sure we stop at the entry point launch_info.GetFlags().Set(eLaunchFlagDebug); // We always launch the process we are going to debug in a separate process - // group, since then we can handle ^C interrupts ourselves w/o having to worry - // about the target getting them as well. + // group, since then we can handle ^C interrupts ourselves w/o having to + // worry about the target getting them as well. launch_info.SetLaunchInSeparateProcessGroup(true); error = LaunchProcess(launch_info); @@ -201,10 +201,10 @@ // process if this happens. process_sp->SetShouldDetach(false); - // If we didn't have any file actions, the pseudo terminal might - // have been used where the slave side was given as the file to - // open for stdin/out/err after we have already opened the master - // so we can read/write stdin/out/err. + // If we didn't have any file actions, the pseudo terminal might have + // been used where the slave side was given as the file to open for + // stdin/out/err after we have already opened the master so we can + // read/write stdin/out/err. int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor(); if (pty_fd != PseudoTerminal::invalid_fd) { process_sp->SetSTDIOFileDescriptor(pty_fd); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -90,9 +90,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -107,9 +107,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -199,9 +199,9 @@ return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -293,8 +293,8 @@ m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -337,10 +337,9 @@ const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For AppleTV, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For AppleTV, the SDK files are all cached locally on the host system. So + // first we ask for the file in the cached SDK, then we attempt to get a + // shared module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -89,9 +89,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -106,9 +106,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -199,9 +199,9 @@ return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -293,8 +293,8 @@ m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -337,10 +337,9 @@ const ModuleSpec &module_spec, lldb_private::Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For AppleWatch, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For AppleWatch, the SDK files are all cached locally on the host system. + // So first we ask for the file in the cached SDK, then we attempt to get a + // shared module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -73,10 +73,9 @@ // NB some extensions might be meaningful and should not be stripped - // "this.binary.file" // should not lose ".file" but GetFileNameStrippingExtension() will do - // precisely that. - // Ideally, we should have a per-platform list of extensions (".exe", - // ".app", ".dSYM", ".framework") - // which should be stripped while leaving "this.binary.file" as-is. + // precisely that. Ideally, we should have a per-platform list of + // extensions (".exe", ".app", ".dSYM", ".framework") which should be + // stripped while leaving "this.binary.file" as-is. ScriptInterpreter *script_interpreter = target->GetDebugger().GetCommandInterpreter().GetScriptInterpreter(); @@ -101,14 +100,11 @@ // FIXME: for Python, we cannot allow certain characters in // module // filenames we import. Theoretically, different scripting - // languages may - // have different sets of forbidden tokens in filenames, and - // that should - // be dealt with by each ScriptInterpreter. For now, we just - // replace dots - // with underscores, but if we ever support anything other than - // Python - // we will need to rework this + // languages may have different sets of forbidden tokens in + // filenames, and that should be dealt with by each + // ScriptInterpreter. For now, we just replace dots with + // underscores, but if we ever support anything other than + // Python we will need to rework this std::replace(module_basename.begin(), module_basename.end(), '.', '_'); std::replace(module_basename.begin(), module_basename.end(), @@ -125,9 +121,9 @@ StreamString path_string; StreamString original_path_string; // for OSX we are going to be in - // .dSYM/Contents/Resources/DWARF/ - // let us go to .dSYM/Contents/Resources/Python/.py - // and see if the file exists + // .dSYM/Contents/Resources/DWARF/ let us go to + // .dSYM/Contents/Resources/Python/.py and see if the + // file exists path_string.Printf("%s/../Python/%s.py", symfile_spec.GetDirectory().GetCString(), module_basename.c_str()); @@ -140,9 +136,8 @@ true); // if we did some replacements of reserved characters, and a - // file with the untampered name - // exists, then warn the user that the file as-is shall not be - // loaded + // file with the untampered name exists, then warn the user + // that the file as-is shall not be loaded if (feedback_stream) { if (module_basename != original_module_basename && orig_script_fspec.Exists()) { @@ -178,8 +173,8 @@ break; } - // If we didn't find the python file, then keep - // stripping the extensions and try again + // If we didn't find the python file, then keep stripping the + // extensions and try again ConstString filename_no_extension( module_spec.GetFileNameStrippingExtension()); if (module_spec.GetFilename() == filename_no_extension) @@ -270,8 +265,8 @@ FileSpec module_cache_spec(cache_path, false); // if rsync is supported, always bring in the file - rsync will be very - // efficient - // when files are the same on the local and remote end of the connection + // efficient when files are the same on the local and remote end of the + // connection if (this->GetSupportsRSync()) { err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) @@ -370,8 +365,8 @@ module_sp.reset(); if (IsRemote()) { - // If we have a remote platform always, let it try and locate - // the shared module first. + // If we have a remote platform always, let it try and locate the shared + // module first. if (m_remote_platform_sp) { error = m_remote_platform_sp->GetSharedModule( module_spec, process, module_sp, module_search_paths_ptr, @@ -453,8 +448,8 @@ switch (machine) { case llvm::Triple::aarch64: { // TODO: fix this with actual darwin breakpoint opcode for arm64. - // right now debugging uses the Z packets with GDB remote so this - // is not needed, but the size needs to be correct... + // right now debugging uses the Z packets with GDB remote so this is not + // needed, but the size needs to be correct... static const uint8_t g_arm64_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7}; trap_opcode = g_arm64_breakpoint_opcode; trap_opcode_size = sizeof(g_arm64_breakpoint_opcode); @@ -548,8 +543,8 @@ HostInfo::GetArchitecture(HostInfo::eArchKind64)); if (platform_arch.IsExactMatch(platform_arch64)) { // This macosx platform supports both 32 and 64 bit. Since we already - // returned the 64 bit arch for idx == 0, return the 32 bit arch - // for idx == 1 + // returned the 64 bit arch for idx == 0, return the 32 bit arch for + // idx == 1 arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); } @@ -558,9 +553,9 @@ return false; } -// The architecture selection rules for arm processors -// These cpu subtypes have distinct names (e.g. armv7f) but armv7 binaries run -// fine on an armv7f processor. +// The architecture selection rules for arm processors These cpu subtypes have +// distinct names (e.g. armv7f) but armv7 binaries run fine on an armv7f +// processor. bool PlatformDarwin::ARMGetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) { @@ -1145,7 +1140,8 @@ if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, temp_file_spec)) { if (temp_file_spec.GetPath(developer_dir_path, sizeof(developer_dir_path))) { - // e.g. /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework + // e.g. + // /Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework char *shared_frameworks = strstr(developer_dir_path, "/SharedFrameworks/LLDB.framework"); if (shared_frameworks) { @@ -1153,7 +1149,8 @@ strncat (developer_dir_path, "/Developer", sizeof (developer_dir_path) - 1); // add /Developer on developer_dir_path_valid = true; } else { - // e.g. /Applications/Xcode.app/Contents/Developer/Toolchains/iOS11.2.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework + // e.g. + // /Applications/Xcode.app/Contents/Developer/Toolchains/iOS11.2.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework char *developer_toolchains = strstr(developer_dir_path, "/Contents/Developer/Toolchains/"); if (developer_toolchains) { @@ -1230,8 +1227,8 @@ m_developer_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_developer_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_developer_directory or + // it should have a valid path if the code gets here assert(m_developer_directory.empty() == false); if (m_developer_directory[0]) return m_developer_directory.c_str(); @@ -1279,9 +1276,9 @@ shell_name++; if (strcmp(shell_name, "sh") == 0) { - // /bin/sh re-exec's itself as /bin/bash requiring another resume. - // But it only does this if the COMMAND_MODE environment variable - // is set to "legacy". + // /bin/sh re-exec's itself as /bin/bash requiring another resume. But it + // only does this if the COMMAND_MODE environment variable is set to + // "legacy". if (launch_info.GetEnvironment().lookup("COMMAND_MODE") == "legacy") return 2; return 1; @@ -1333,9 +1330,8 @@ // First get the program file spec. If lldb.so or LLDB.framework is running // in a program and that program is Xcode, the path returned with be the - // path - // to Xcode.app/Contents/MacOS/Xcode, so this will be the correct Xcode to - // use. + // path to Xcode.app/Contents/MacOS/Xcode, so this will be the correct + // Xcode to use. fspec = HostInfo::GetProgramFileSpec(); if (fspec) { @@ -1679,10 +1675,8 @@ } } // For simulator platforms, do NOT call back through - // Platform::GetOSVersion() - // as it might call Process::GetHostOSVersion() which we don't want as it - // will be - // incorrect + // Platform::GetOSVersion() as it might call Process::GetHostOSVersion() + // which we don't want as it will be incorrect return false; } @@ -1695,8 +1689,8 @@ // any executable directories that should be searched. static std::vector g_executable_dirs; - // Find the global list of directories that we will search for - // executables once so we don't keep doing the work over and over. + // Find the global list of directories that we will search for executables + // once so we don't keep doing the work over and over. static llvm::once_flag g_once_flag; llvm::call_once(g_once_flag, []() { @@ -1730,19 +1724,18 @@ lldb_private::Status PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) { - // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr - // if the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't - // require any specific value; rather, it just needs to exist). - // We will set it here as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag - // is not set. Xcode makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell + // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr if + // the OS_ACTIVITY_DT_MODE environment variable is set. (It doesn't require + // any specific value; rather, it just needs to exist). We will set it here + // as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag is not set. Xcode + // makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell // LLDB *not* to muck with the OS_ACTIVITY_DT_MODE flag when they // specifically want it unset. const char *disable_env_var = "IDE_DISABLED_OS_ACTIVITY_DT_MODE"; auto &env_vars = launch_info.GetEnvironment(); if (!env_vars.count(disable_env_var)) { - // We want to make sure that OS_ACTIVITY_DT_MODE is set so that - // we get os_log and NSLog messages mirrored to the target process - // stderr. + // We want to make sure that OS_ACTIVITY_DT_MODE is set so that we get + // os_log and NSLog messages mirrored to the target process stderr. env_vars.try_emplace("OS_ACTIVITY_DT_MODE", "enable"); } @@ -1757,15 +1750,16 @@ ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { const FileSpec &platform_file = module_spec.GetFileSpec(); - // See if the file is present in any of the module_search_paths_ptr directories. + // See if the file is present in any of the module_search_paths_ptr + // directories. if (!module_sp && module_search_paths_ptr && platform_file) { - // create a vector of all the file / directory names in platform_file - // e.g. this might be + // create a vector of all the file / directory names in platform_file e.g. + // this might be // /System/Library/PrivateFrameworks/UIFoundation.framework/UIFoundation // - // We'll need to look in the module_search_paths_ptr directories for - // both "UIFoundation" and "UIFoundation.framework" -- most likely the - // latter will be the one we find there. + // We'll need to look in the module_search_paths_ptr directories for both + // "UIFoundation" and "UIFoundation.framework" -- most likely the latter + // will be the one we find there. FileSpec platform_pull_apart(platform_file); std::vector path_parts; @@ -1784,25 +1778,24 @@ Log *log_verbose = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log_verbose) log_verbose->Printf ("PlatformRemoteDarwinDevice::GetSharedModule searching for binary in search-path %s", module_search_paths_ptr->GetFileSpecAtIndex(i).GetPath().c_str()); - // Create a new FileSpec with this module_search_paths_ptr - // plus just the filename ("UIFoundation"), then the parent - // dir plus filename ("UIFoundation.framework/UIFoundation") - // etc - up to four names (to handle "Foo.framework/Contents/MacOS/Foo") + // Create a new FileSpec with this module_search_paths_ptr plus just the + // filename ("UIFoundation"), then the parent dir plus filename + // ("UIFoundation.framework/UIFoundation") etc - up to four names (to + // handle "Foo.framework/Contents/MacOS/Foo") for (size_t j = 0; j < 4 && j < path_parts_size - 1; ++j) { FileSpec path_to_try(module_search_paths_ptr->GetFileSpecAtIndex(i)); // Add the components backwards. For - // .../PrivateFrameworks/UIFoundation.framework/UIFoundation - // path_parts is + // .../PrivateFrameworks/UIFoundation.framework/UIFoundation path_parts + // is // [0] UIFoundation // [1] UIFoundation.framework // [2] PrivateFrameworks // // and if 'j' is 2, we want to append path_parts[1] and then - // path_parts[0], aka - // 'UIFoundation.framework/UIFoundation', to the module_search_paths_ptr - // path. + // path_parts[0], aka 'UIFoundation.framework/UIFoundation', to the + // module_search_paths_ptr path. for (int k = j; k >= 0; --k) { path_to_try.AppendPathComponent(path_parts[k]); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -92,11 +92,9 @@ } // This is a special plugin that we don't want to activate just based on an - // ArchSpec for normal - // userland debugging. It is only useful in kernel debug sessions and the - // DynamicLoaderDarwinPlugin - // (or a user doing 'platform select') will force the creation of this - // Platform plugin. + // ArchSpec for normal userland debugging. It is only useful in kernel debug + // sessions and the DynamicLoaderDarwinPlugin (or a user doing 'platform + // select') will force the creation of this Platform plugin. if (force == false) { if (log) log->Printf("PlatformDarwinKernel::%s() aborting creation of platform " @@ -115,9 +113,8 @@ create = true; break; - // Only accept "unknown" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -133,9 +130,8 @@ case llvm::Triple::WatchOS: case llvm::Triple::TvOS: break; - // Only accept "vendor" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "vendor" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -341,11 +337,9 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() { // Differentiate between "ios debug session" and "mac debug session" so we - // don't index - // kext bundles that won't be used in this debug session. If this is an ios - // kext debug - // session, looking in /System/Library/Extensions is a waste of stat()s, for - // example. + // don't index kext bundles that won't be used in this debug session. If + // this is an ios kext debug session, looking in /System/Library/Extensions + // is a waste of stat()s, for example. // DeveloperDirectory is something like // "/Applications/Xcode.app/Contents/Developer" @@ -368,9 +362,8 @@ AddSDKSubdirsToSearchPaths("/Volumes/KernelDebugKit"); AddSDKSubdirsToSearchPaths("/AppleInternal/Developer/KDKs"); - // The KDKs distributed from Apple installed on external - // developer systems may be in directories like - // /Library/Developer/KDKs/KDK_10.10_14A298i.kdk + // The KDKs distributed from Apple installed on external developer systems + // may be in directories like /Library/Developer/KDKs/KDK_10.10_14A298i.kdk AddSDKSubdirsToSearchPaths("/Library/Developer/KDKs"); if (m_ios_debug_session != eLazyBoolNo) { @@ -450,9 +443,8 @@ return FileSpec::eEnumerateDirectoryResultNext; } -// Recursively search trough m_search_directories looking for -// kext and kernel binaries, adding files found to the appropriate -// lists. +// Recursively search trough m_search_directories looking for kext and kernel +// binaries, adding files found to the appropriate lists. void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() { const uint32_t num_dirs = m_search_directories.size(); for (uint32_t i = 0; i < num_dirs; i++) { @@ -476,13 +468,11 @@ } } -// We're only doing a filename match here. We won't try opening the file to see -// if it's really -// a kernel or not until we need to find a kernel of a given UUID. There's no -// cheap way to find -// the UUID of a file (or if it's a Mach-O binary at all) without creating a -// whole Module for -// the file and throwing it away if it's not wanted. +// We're only doing a filename match here. We won't try opening the file to +// see if it's really a kernel or not until we need to find a kernel of a given +// UUID. There's no cheap way to find the UUID of a file (or if it's a Mach-O +// binary at all) without creating a whole Module for the file and throwing it +// away if it's not wanted. // // Recurse into any subdirectories found. @@ -650,8 +640,8 @@ return false; } -// Given a FileSpec of /dir/dir/mach.development.t7004 -// Return true if a dSYM exists next to it: +// Given a FileSpec of /dir/dir/mach.development.t7004 Return true if a dSYM +// exists next to it: // /dir/dir/mach.development.t7004.dSYM bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { FileSpec kernel_dsym = kernel_binary; @@ -694,8 +684,8 @@ } } - // Give the generic methods, including possibly calling into - // DebugSymbols framework on macOS systems, a chance. + // Give the generic methods, including possibly calling into DebugSymbols + // framework on macOS systems, a chance. error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); @@ -749,8 +739,8 @@ } } - // Give the generic methods, including possibly calling into - // DebugSymbols framework on macOS systems, a chance. + // Give the generic methods, including possibly calling into DebugSymbols + // framework on macOS systems, a chance. error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp, module_search_paths_ptr, old_module_sp_ptr, did_create_ptr); @@ -803,11 +793,9 @@ } // First try to create a ModuleSP with the file / arch and see if the UUID - // matches. - // If that fails (this exec file doesn't have the correct uuid), don't call - // GetSharedModule - // (which may call in to the DebugSymbols framework and therefore can be - // slow.) + // matches. If that fails (this exec file doesn't have the correct uuid), + // don't call GetSharedModule (which may call in to the DebugSymbols + // framework and therefore can be slow.) ModuleSP module_sp(new Module(exe_spec)); if (module_sp && module_sp->GetObjectFile() && module_sp->MatchesModuleSpec(exe_spec)) { @@ -851,17 +839,13 @@ #else // __APPLE__ -// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies on -// PlatformDarwinKernel for the plug-in name, we compile just the plug-in name -// in -// here to avoid issues. We are tracking an internal bug to resolve this issue -// by -// either not compiling in DynamicLoaderDarwinKernel for non-apple builds, or to -// make -// PlatformDarwinKernel build on all systems. PlatformDarwinKernel is currently -// not -// compiled on other platforms due to the use of the Mac-specific -// source/Host/macosx/cfcpp utilities. +// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies +// on PlatformDarwinKernel for the plug-in name, we compile just the plug-in +// name in here to avoid issues. We are tracking an internal bug to resolve +// this issue by either not compiling in DynamicLoaderDarwinKernel for non- +// apple builds, or to make PlatformDarwinKernel build on all systems. +// PlatformDarwinKernel is currently not compiled on other platforms due to the +// use of the Mac-specific source/Host/macosx/cfcpp utilities. lldb_private::ConstString PlatformDarwinKernel::GetPluginNameStatic() { static lldb_private::ConstString g_name("darwin-kernel"); Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -91,9 +91,8 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -109,9 +108,8 @@ case llvm::Triple::MacOSX: break; #if defined(__APPLE__) - // Only accept "vendor" for vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "vendor" for vendor if the host is Apple and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -98,9 +98,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -93,9 +93,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -123,8 +123,8 @@ #if defined(__APPLE__) && \ (defined(__arm__) || defined(__arm64__) || defined(__aarch64__)) - // If lldb is running on a watch, this isn't a RemoteWatch environment; it's a - // local system environment. + // If lldb is running on a watch, this isn't a RemoteWatch environment; it's + // a local system environment. if (force == false) { create = false; } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -97,9 +97,9 @@ return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, resolved_module_spec.GetArchitecture()); @@ -183,8 +183,8 @@ &builtin_sdk_directory_infos); // Only add SDK directories that have symbols in them, some SDKs only - // contain - // developer disk images and no symbols, so they aren't useful to us. + // contain developer disk images and no symbols, so they aren't useful to + // us. FileSpec sdk_symbols_symlink_fspec; for (const auto &sdk_directory_info : builtin_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; @@ -244,8 +244,8 @@ if (UpdateSDKDirectoryInfosIfNeeded()) { const uint32_t num_sdk_infos = m_sdk_directory_infos.size(); - // Check to see if the user specified a build string. If they did, then - // be sure to match it. + // Check to see if the user specified a build string. If they did, then be + // sure to match it. std::vector check_sdk_info(num_sdk_infos, true); ConstString build(m_sdk_build); if (build) { @@ -253,8 +253,8 @@ check_sdk_info[i] = m_sdk_directory_infos[i].build == build; } - // If we are connected we can find the version of the OS the platform - // us running on and select the right SDK + // If we are connected we can find the version of the OS the platform us + // running on and select the right SDK uint32_t major, minor, update; if (GetOSVersion(major, minor, update)) { if (UpdateSDKDirectoryInfosIfNeeded()) { @@ -366,8 +366,8 @@ } } // We should have put a single NULL character into - // m_device_support_directory_for_os_version - // or it should have a valid path if the code gets here + // m_device_support_directory_for_os_version or it should have a valid path + // if the code gets here assert(m_device_support_directory_for_os_version.empty() == false); if (m_device_support_directory_for_os_version[0]) return m_device_support_directory_for_os_version.c_str(); @@ -492,10 +492,9 @@ const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For iOS, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For iOS, the SDK files are all cached locally on the host system. So first + // we ask for the file in the cached SDK, then we attempt to get a shared + // module for the right architecture with the right UUID. const FileSpec &platform_file = module_spec.GetFileSpec(); Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); @@ -510,8 +509,7 @@ const uint32_t num_sdk_infos = m_sdk_directory_infos.size(); // If we are connected we migth be able to correctly deduce the SDK - // directory - // using the OS build. + // directory using the OS build. const uint32_t connected_sdk_idx = GetConnectedSDKIndex(); if (connected_sdk_idx < num_sdk_infos) { LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, @@ -528,8 +526,8 @@ } } - // Try the last SDK index if it is set as most files from an SDK - // will tend to be valid in that same SDK. + // Try the last SDK index if it is set as most files from an SDK will tend + // to be valid in that same SDK. if (m_last_module_sdk_idx < num_sdk_infos) { LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, m_sdk_directory_infos[m_last_module_sdk_idx].directory); @@ -544,9 +542,9 @@ } } - // First try for an exact match of major, minor and update: - // If a particalar SDK version was specified via --version or --build, look - // for a match on disk. + // First try for an exact match of major, minor and update: If a particalar + // SDK version was specified via --version or --build, look for a match on + // disk. const SDKDirectoryInfo *current_sdk_info = GetSDKDirectoryForCurrentOSVersion(); const uint32_t current_sdk_idx = @@ -570,8 +568,7 @@ // Second try all SDKs that were found. for (uint32_t sdk_idx = 0; sdk_idx < num_sdk_infos; ++sdk_idx) { if (m_last_module_sdk_idx == sdk_idx) { - // Skip the last module SDK index if we already searched - // it above + // Skip the last module SDK index if we already searched it above continue; } LLDB_LOGV(log, "Searching for {0} in sdk path {1}", platform_file, @@ -582,8 +579,8 @@ error = ResolveExecutable(platform_module_spec, module_sp, NULL); if (module_sp) { - // Remember the index of the last SDK that we found a file - // in in case the wrong SDK was selected. + // Remember the index of the last SDK that we found a file in in case + // the wrong SDK was selected. m_last_module_sdk_idx = sdk_idx; error.Clear(); return error; Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -88,9 +88,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -91,9 +91,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the vendor if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the vendor if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownArch: create = !arch->TripleVendorWasSpecified(); break; @@ -112,9 +112,9 @@ break; #if defined(__APPLE__) - // Only accept "unknown" for the OS if the host is Apple and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is Apple and it + // "unknown" wasn't specified (it was just returned because it was NOT + // specified) case llvm::Triple::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -205,9 +205,9 @@ return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact ARM slice wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact ARM slice wasn't found + // so ask the platform for the architectures that we should be using (in + // the correct order) and see if we can find a match that way StreamString arch_names; ArchSpec platform_arch; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( @@ -298,8 +298,8 @@ m_sdk_directory.assign(1, '\0'); } - // We should have put a single NULL character into m_sdk_directory - // or it should have a valid path if the code gets here + // We should have put a single NULL character into m_sdk_directory or it + // should have a valid path if the code gets here assert(m_sdk_directory.empty() == false); if (m_sdk_directory[0]) return m_sdk_directory.c_str(); @@ -342,10 +342,9 @@ const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, ModuleSP *old_module_sp_ptr, bool *did_create_ptr) { - // For iOS, the SDK files are all cached locally on the host - // system. So first we ask for the file in the cached SDK, - // then we attempt to get a shared module for the right architecture - // with the right UUID. + // For iOS, the SDK files are all cached locally on the host system. So first + // we ask for the file in the cached SDK, then we attempt to get a shared + // module for the right architecture with the right UUID. Status error; ModuleSpec platform_module_spec(module_spec); const FileSpec &platform_file = module_spec.GetFileSpec(); @@ -409,14 +408,14 @@ if (arch.IsValid()) { if (idx == 2) arch.GetTriple().setOS(llvm::Triple::IOS); - // 32/64: return "i386-apple-ios" for architecture 2 - // 32/64: return "i386-apple-macosx" for architecture 3 + // 32/64: return "i386-apple-ios" for architecture 2 32/64: return + // "i386-apple-macosx" for architecture 3 return true; } } } else if (idx == 1) { - // This macosx platform supports only 32 bit, so return the *-apple-macosx - // version + // This macosx platform supports only 32 bit, so return the *-apple- + // macosx version arch = platform_arch; return true; } Index: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp +++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp @@ -30,8 +30,8 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" -// Define these constants from NetBSD mman.h for use when targeting -// remote netbsd systems even when host has different values. +// Define these constants from NetBSD mman.h for use when targeting remote +// netbsd systems even when host has different values. #define MAP_PRIVATE 0x0002 #define MAP_ANON 0x1000 @@ -134,7 +134,8 @@ arch = hostArch; return arch.IsValid(); } else if (idx == 1) { - // If the default host architecture is 64-bit, look for a 32-bit variant + // If the default host architecture is 64-bit, look for a 32-bit + // variant if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit()) { arch = HostInfo::GetArchitecture(HostInfo::eArchKind32); return arch.IsValid(); @@ -160,13 +161,10 @@ return false; } // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the - // vendor by - // calling triple.SetVendorName("unknown") so that it is a "unspecified - // unknown". - // This means when someone calls triple.GetVendorName() it will return an - // empty string - // which indicates that the vendor can be set when two architectures are - // merged + // vendor by calling triple.SetVendorName("unknown") so that it is a + // "unspecified unknown". This means when someone calls + // triple.GetVendorName() it will return an empty string which indicates + // that the vendor can be set when two architectures are merged // Now set the triple into "arch" and return true arch.SetTriple(triple); @@ -240,8 +238,8 @@ } // For local debugging, NetBSD will override the debug logic to use llgs-launch -// rather than lldb-launch, llgs-attach. This differs from current lldb-launch, -// debugserver-attach approach on MacOSX. +// rather than lldb-launch, llgs-attach. This differs from current lldb- +// launch, debugserver-attach approach on MacOSX. lldb::ProcessSP PlatformNetBSD::DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be NULL, if NULL create a new @@ -265,8 +263,8 @@ launch_info.GetFlags().Set(eLaunchFlagDebug); // We always launch the process we are going to debug in a separate process - // group, since then we can handle ^C interrupts ourselves w/o having to worry - // about the target getting them as well. + // group, since then we can handle ^C interrupts ourselves w/o having to + // worry about the target getting them as well. launch_info.SetLaunchInSeparateProcessGroup(true); // Ensure we have a target. Index: lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp +++ lldb/trunk/source/Plugins/Platform/OpenBSD/PlatformOpenBSD.cpp @@ -30,8 +30,8 @@ #include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" -// Define these constants from OpenBSD mman.h for use when targeting -// remote openbsd systems even when host has different values. +// Define these constants from OpenBSD mman.h for use when targeting remote +// openbsd systems even when host has different values. #define MAP_PRIVATE 0x0002 #define MAP_ANON 0x1000 @@ -58,9 +58,8 @@ break; #if defined(__OpenBSD__) - // Only accept "unknown" for the OS if the host is BSD and - // it "unknown" wasn't specified (it was just returned because it - // was NOT specified) + // Only accept "unknown" for the OS if the host is BSD and it "unknown" + // wasn't specified (it was just returned because it was NOT specified) case llvm::Triple::OSType::UnknownOS: create = !arch->TripleOSWasSpecified(); break; @@ -167,13 +166,10 @@ return false; } // Leave the vendor as "llvm::Triple:UnknownVendor" and don't specify the - // vendor by - // calling triple.SetVendorName("unknown") so that it is a "unspecified - // unknown". - // This means when someone calls triple.GetVendorName() it will return an - // empty string - // which indicates that the vendor can be set when two architectures are - // merged + // vendor by calling triple.SetVendorName("unknown") so that it is a + // "unspecified unknown". This means when someone calls + // triple.GetVendorName() it will return an empty string which indicates + // that the vendor can be set when two architectures are merged // Now set the triple into "arch" and return true arch.SetTriple(triple); Index: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -129,8 +129,8 @@ ModuleSpec resolved_module_spec(module_spec); if (IsHost()) { - // If we have "ls" as the exe_file, resolve the executable location based on - // the current path variables + // If we have "ls" as the exe_file, resolve the executable location based + // on the current path variables if (!resolved_module_spec.GetFileSpec().Exists()) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); resolved_module_spec.GetFileSpec().SetFile(exe_path, true); @@ -215,9 +215,9 @@ resolved_module_spec.GetArchitecture().GetArchitectureName()); } } else { - // No valid architecture was specified, ask the platform for - // the architectures that we should be using (in the correct order) - // and see if we can find a match that way + // No valid architecture was specified, ask the platform for the + // architectures that we should be using (in the correct order) and see + // if we can find a match that way StreamString arch_names; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, resolved_module_spec.GetArchitecture()); @@ -524,8 +524,8 @@ Host::RunShellCommand(command.GetData(), NULL, &retcode, NULL, NULL, 60); if (retcode == 0) return Status(); - // If we are here, rsync has failed - let's try the slow way before giving - // up + // If we are here, rsync has failed - let's try the slow way before + // giving up } // open src and dst // read/write, read/write, read/write, ... @@ -866,9 +866,8 @@ if (IsHost()) { // We are going to hand this process off to debugserver which will be in - // charge of setting the exit status. - // We still need to reap it from lldb but if we let the monitor thread also - // set the exit status, we set up a + // charge of setting the exit status. We still need to reap it from lldb + // but if we let the monitor thread also set the exit status, we set up a // race between debugserver & us for who will find out about the debugged // process's death. launch_info.GetFlags().Set(eLaunchFlagDontSetExitStatus); @@ -932,10 +931,11 @@ PlatformPOSIX::MakeLoadImageUtilityFunction(ExecutionContext &exe_ctx, Status &error) { - // Remember to prepend this with the prefix from GetLibdlFunctionDeclarations. - // The returned values are all in __lldb_dlopen_result for consistency. - // The wrapper returns a void * but doesn't use it because - // UtilityFunctions don't work with void returns at present. + // Remember to prepend this with the prefix from + // GetLibdlFunctionDeclarations. The returned values are all in + // __lldb_dlopen_result for consistency. The wrapper returns a void * but + // doesn't use it because UtilityFunctions don't work with void returns at + // present. static const char *dlopen_wrapper_code = R"( struct __lldb_dlopen_result { void *image_ptr; @@ -1037,7 +1037,7 @@ Status utility_error; - // The UtilityFunction is held in the Process. Platforms don't track the + // The UtilityFunction is held in the Process. Platforms don't track the // lifespan of the Targets that use them, we can't put this in the Platform. UtilityFunction *dlopen_utility_func = process->GetLoadImageUtilityFunction(this); @@ -1059,8 +1059,8 @@ } arguments = do_dlopen_function->GetArgumentValues(); - // Now insert the path we are searching for and the result structure into - // the target. + // Now insert the path we are searching for and the result structure into the + // target. uint32_t permissions = ePermissionsReadable|ePermissionsWritable; size_t path_len = path.size() + 1; lldb::addr_t path_addr = process->AllocateMemory(path_len, @@ -1084,8 +1084,8 @@ return LLDB_INVALID_IMAGE_TOKEN; } - // Make space for our return structure. It is two pointers big: the token and - // the error string. + // Make space for our return structure. It is two pointers big: the token + // and the error string. const uint32_t addr_size = process->GetAddressByteSize(); lldb::addr_t return_addr = process->CallocateMemory(2*addr_size, permissions, Index: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -237,9 +237,9 @@ resolved_module_spec.GetArchitecture().GetArchitectureName()); } } else { - // No valid architecture was specified, ask the platform for - // the architectures that we should be using (in the correct order) - // and see if we can find a match that way + // No valid architecture was specified, ask the platform for the + // architectures that we should be using (in the correct order) and see + // if we can find a match that way StreamString arch_names; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, resolved_module_spec.GetArchitecture()); @@ -413,29 +413,23 @@ Debugger &debugger, Target *target, Status &error) { // Windows has special considerations that must be followed when launching or - // attaching to a process. The - // key requirement is that when launching or attaching to a process, you must - // do it from the same the thread - // that will go into a permanent loop which will then receive debug events - // from the process. In particular, - // this means we can't use any of LLDB's generic mechanisms to do it for us, - // because it doesn't have the - // special knowledge required for setting up the background thread or passing - // the right flags. + // attaching to a process. The key requirement is that when launching or + // attaching to a process, you must do it from the same the thread that will + // go into a permanent loop which will then receive debug events from the + // process. In particular, this means we can't use any of LLDB's generic + // mechanisms to do it for us, because it doesn't have the special knowledge + // required for setting up the background thread or passing the right flags. // // Another problem is that that LLDB's standard model for debugging a process - // is to first launch it, have - // it stop at the entry point, and then attach to it. In Windows this doesn't - // quite work, you have to - // specify as an argument to CreateProcess() that you're going to debug the - // process. So we override DebugProcess - // here to handle this. Launch operations go directly to the process plugin, - // and attach operations almost go - // directly to the process plugin (but we hijack the events first). In - // essence, we encapsulate all the logic - // of Launching and Attaching in the process plugin, and - // PlatformWindows::DebugProcess is just a pass-through - // to get to the process plugin. + // is to first launch it, have it stop at the entry point, and then attach to + // it. In Windows this doesn't quite work, you have to specify as an + // argument to CreateProcess() that you're going to debug the process. So we + // override DebugProcess here to handle this. Launch operations go directly + // to the process plugin, and attach operations almost go directly to the + // process plugin (but we hijack the events first). In essence, we + // encapsulate all the logic of Launching and Attaching in the process + // plugin, and PlatformWindows::DebugProcess is just a pass-through to get to + // the process plugin. if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) { // This is a process attach. Don't need to launch anything. @@ -538,8 +532,8 @@ module_sp.reset(); if (IsRemote()) { - // If we have a remote platform always, let it try and locate - // the shared module first. + // If we have a remote platform always, let it try and locate the shared + // module first. if (m_remote_platform_sp) { error = m_remote_platform_sp->GetSharedModule( module_spec, process, module_sp, module_search_paths_ptr, Index: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -118,9 +118,9 @@ return error; exe_module_sp.reset(); } - // No valid architecture was specified or the exact arch wasn't - // found so ask the platform for the architectures that we should be - // using (in the correct order) and see if we can find a match that way + // No valid architecture was specified or the exact arch wasn't found so + // ask the platform for the architectures that we should be using (in the + // correct order) and see if we can find a match that way StreamString arch_names; for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, resolved_module_spec.GetArchitecture()); @@ -277,8 +277,7 @@ const FileSpec &working_dir) { if (IsConnected()) { // Clear the working directory it case it doesn't get set correctly. This - // will - // for use to re-read it + // will for use to re-read it Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM); if (log) log->Printf("PlatformRemoteGDBServer::SetRemoteWorkingDirectory('%s')", @@ -540,9 +539,8 @@ bool launch_result = false; if (remote_triple.getVendor() == llvm::Triple::Apple && remote_triple.getOS() == llvm::Triple::IOS) { - // When remote debugging to iOS, we use a USB mux that always talks - // to localhost, so we will need the remote debugserver to accept - // connections + // When remote debugging to iOS, we use a USB mux that always talks to + // localhost, so we will need the remote debugserver to accept connections // only from localhost, no matter what our current hostname is launch_result = m_gdb_client.LaunchGDBServer("127.0.0.1", pid, port, socket_name); @@ -740,8 +738,8 @@ if (m_remote_signals_sp) return m_remote_signals_sp; - // If packet not implemented or JSON failed to parse, - // we'll guess the signal set based on the remote architecture. + // If packet not implemented or JSON failed to parse, we'll guess the signal + // set based on the remote architecture. m_remote_signals_sp = UnixSignals::Create(GetRemoteSystemArchitecture()); StringExtractorGDBRemote response; Index: lldb/trunk/source/Plugins/Process/Darwin/CFString.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/CFString.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/CFString.cpp @@ -91,9 +91,8 @@ return CFString::UTF8(get(), str); } -// Static function that puts a copy of the UTF8 contents of CF_STR into STR -// and returns the C string pointer that is contained in STR when successful, -// else +// Static function that puts a copy of the UTF8 contents of CF_STR into STR and +// returns the C string pointer that is contained in STR when successful, else // NULL is returned. This allows the std::string parameter to own the extracted // string, // and also allows that string to be returned as a C string pointer that can be @@ -120,9 +119,9 @@ // Static function that puts a copy of the file system representation of CF_STR // into STR and returns the C string pointer that is contained in STR when -// successful, else NULL is returned. This allows the std::string parameter -// to own the extracted string, and also allows that string to be returned as -// a C string pointer that can be used. +// successful, else NULL is returned. This allows the std::string parameter to +// own the extracted string, and also allows that string to be returned as a C +// string pointer that can be used. const char *CFString::FileSystemRepresentation(CFStringRef cf_str, std::string &str) { Index: lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp @@ -142,8 +142,8 @@ } // Use a fork that ties the child process's stdin/out/err to a pseudo - // terminal so we can read it in our MachProcess::STDIOThread - // as unbuffered io. + // terminal so we can read it in our MachProcess::STDIOThread as unbuffered + // io. PseudoTerminal pty; char fork_error[256]; memset(fork_error, 0, sizeof(fork_error)); @@ -167,12 +167,12 @@ // Get BSD signals as mach exceptions. ::ptrace(PT_SIGEXC, 0, 0, 0); - // If our parent is setgid, lets make sure we don't inherit those - // extra powers due to nepotism. + // If our parent is setgid, lets make sure we don't inherit those extra + // powers due to nepotism. if (::setgid(getgid()) == 0) { - // Let the child have its own process group. We need to execute - // this call in both the child and parent to avoid a race - // condition between the two processes. + // Let the child have its own process group. We need to execute this call + // in both the child and parent to avoid a race condition between the two + // processes. // Set the child process group to match its pid. ::setpgid(0, 0); @@ -183,23 +183,22 @@ // Turn this process into the given executable. ::execv(path, (char *const *)argv); } - // Exit with error code. Child process should have taken - // over in above exec call and if the exec fails it will - // exit the child process below. + // Exit with error code. Child process should have taken over in above exec + // call and if the exec fails it will exit the child process below. ::exit(127); } else { //-------------------------------------------------------------- // Parent process //-------------------------------------------------------------- - // Let the child have its own process group. We need to execute - // this call in both the child and parent to avoid a race condition - // between the two processes. + // Let the child have its own process group. We need to execute this call + // in both the child and parent to avoid a race condition between the two + // processes. // Set the child process group to match its pid ::setpgid(*pid, *pid); if (pty_fd) { - // Release our master pty file descriptor so the pty class doesn't - // close it and so we can continue to use it in our STDIO thread + // Release our master pty file descriptor so the pty class doesn't close + // it and so we can continue to use it in our STDIO thread *pty_fd = pty.ReleaseMasterFileDescriptor(); } } @@ -302,8 +301,7 @@ return error; } - // Ensure we clean up the spawnattr structure however we exit this - // function. + // Ensure we clean up the spawnattr structure however we exit this function. std::unique_ptr spawnattr_up( &attr, ::posix_spawnattr_destroy); @@ -332,9 +330,9 @@ #if !defined(__arm__) - // We don't need to do this for ARM, and we really shouldn't now that we - // have multiple CPU subtypes and no posix_spawnattr call that allows us - // to set which CPU subtype to launch... + // We don't need to do this for ARM, and we really shouldn't now that we have + // multiple CPU subtypes and no posix_spawnattr call that allows us to set + // which CPU subtype to launch... cpu_type_t desired_cpu_type = launch_info.GetArchitecture().GetMachOCPUType(); if (desired_cpu_type != LLDB_INVALID_CPUTYPE) { size_t ocount = 0; @@ -374,10 +372,10 @@ int (*)(posix_spawn_file_actions_t *)> file_actions_up(&file_actions, ::posix_spawn_file_actions_destroy); - // We assume the caller has setup the file actions appropriately. We - // are not in the business of figuring out what we really need here. - // lldb-server will have already called FinalizeFileActions() as well - // to button these up properly. + // We assume the caller has setup the file actions appropriately. We are not + // in the business of figuring out what we really need here. lldb-server will + // have already called FinalizeFileActions() as well to button these up + // properly. const size_t num_actions = launch_info.GetNumFileActions(); for (size_t action_index = 0; action_index < num_actions; ++action_index) { const FileAction *const action = @@ -533,8 +531,8 @@ if (error.Success()) { launch_info.SetProcessID(static_cast(pid)); } else { - // Reset any variables that might have been set during a failed - // launch attempt. + // Reset any variables that might have been set during a failed launch + // attempt. if (pty_master_fd) *pty_master_fd = -1; @@ -616,8 +614,8 @@ if (pty_master_fd) *pty_master_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor(); } else { - // Reset any variables that might have been set during a failed - // launch attempt. + // Reset any variables that might have been set during a failed launch + // attempt. if (pty_master_fd) *pty_master_fd = -1; @@ -636,8 +634,8 @@ } if (launch_info.GetProcessID() == LLDB_INVALID_PROCESS_ID) { - // If we don't have a valid process ID and no one has set the error, - // then return a generic error. + // If we don't have a valid process ID and no one has set the error, then + // return a generic error. if (error.Success()) error.SetErrorStringWithFormat("%s(): failed to launch, no reason " "specified", Index: lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/MachException.cpp @@ -247,20 +247,19 @@ bool success = false; state.task_port = task; g_message = &state; - // The exc_server function is the MIG generated server handling function - // to handle messages from the kernel relating to the occurrence of an - // exception in a thread. Such messages are delivered to the exception port - // set via thread_set_exception_ports or task_set_exception_ports. When an - // exception occurs in a thread, the thread sends an exception message to - // its exception port, blocking in the kernel waiting for the receipt of a - // reply. The exc_server function performs all necessary argument handling - // for this kernel message and calls catch_exception_raise, - // catch_exception_raise_state or catch_exception_raise_state_identity, - // which should handle the exception. If the called routine returns - // KERN_SUCCESS, a reply message will be sent, allowing the thread to - // continue from the point of the exception; otherwise, no reply message - // is sent and the called routine must have dealt with the exception - // thread directly. + // The exc_server function is the MIG generated server handling function to + // handle messages from the kernel relating to the occurrence of an exception + // in a thread. Such messages are delivered to the exception port set via + // thread_set_exception_ports or task_set_exception_ports. When an exception + // occurs in a thread, the thread sends an exception message to its exception + // port, blocking in the kernel waiting for the receipt of a reply. The + // exc_server function performs all necessary argument handling for this + // kernel message and calls catch_exception_raise, + // catch_exception_raise_state or catch_exception_raise_state_identity, which + // should handle the exception. If the called routine returns KERN_SUCCESS, a + // reply message will be sent, allowing the thread to continue from the point + // of the exception; otherwise, no reply message is sent and the called + // routine must have dealt with the exception thread directly. if (mach_exc_server(&exc_msg.hdr, &reply_msg.hdr)) { success = true; } else { @@ -383,9 +382,9 @@ log->Printf("MachException::PortInfo::%s(task = 0x%4.4x)", __FUNCTION__, task); - // Be careful to be able to have debugserver built on a newer OS than what - // it is currently running on by being able to start with all exceptions - // and back off to just what is supported on the current system + // Be careful to be able to have debugserver built on a newer OS than what it + // is currently running on by being able to start with all exceptions and + // back off to just what is supported on the current system mask = LLDB_EXC_MASK; count = (sizeof(ports) / sizeof(ports[0])); Index: lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp @@ -104,8 +104,8 @@ return error; } - // Finalize the processing needed to debug the launched process with - // a NativeProcessDarwin instance. + // Finalize the processing needed to debug the launched process with a + // NativeProcessDarwin instance. error = np_darwin_sp->FinalizeLaunch(launch_flavor, mainloop); if (!error.Success()) { if (log) @@ -194,9 +194,9 @@ "mach exception port monitor thread: %s", __FUNCTION__, error.AsCString()); - // Terminate the inferior process. There's nothing meaningful we can - // do if we can't receive signals and exceptions. Since we launched - // the process, it's fair game for us to kill it. + // Terminate the inferior process. There's nothing meaningful we can do if + // we can't receive signals and exceptions. Since we launched the process, + // it's fair game for us to kill it. ::ptrace(PT_KILL, m_pid, 0, 0); SetState(eStateExited); @@ -243,9 +243,9 @@ } if (TaskPortForProcessID(error) == TASK_NULL) { - // We failed to get the task for our process ID which is bad. - // Kill our process; otherwise, it will be stopped at the entry - // point and get reparented to someone else and never go away. + // We failed to get the task for our process ID which is bad. Kill our + // process; otherwise, it will be stopped at the entry point and get + // reparented to someone else and never go away. if (log) log->Printf("NativeProcessDarwin::%s(): could not get task port " "for process, sending SIGKILL and exiting: %s", @@ -277,9 +277,9 @@ return false; } -// Called by the exception thread when an exception has been received from -// our process. The exception message is completely filled and the exception -// data has already been copied. +// Called by the exception thread when an exception has been received from our +// process. The exception message is completely filled and the exception data +// has already been copied. void NativeProcessDarwin::ExceptionMessageReceived( const MachException::Message &message) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); @@ -290,8 +290,8 @@ SuspendTask(); } - // Use a locker to automatically unlock our mutex in case of exceptions - // Add the exception to our internal exception stack + // Use a locker to automatically unlock our mutex in case of exceptions Add + // the exception to our internal exception stack m_exception_messages.push_back(message); if (log) @@ -324,13 +324,12 @@ // Ensure we don't get CPU starved. MaybeRaiseThreadPriority(); - // We keep a count of the number of consecutive exceptions received so - // we know to grab all exceptions without a timeout. We do this to get a - // bunch of related exceptions on our exception port so we can process - // then together. When we have multiple threads, we can get an exception - // per thread and they will come in consecutively. The main loop in this - // thread can stop periodically if needed to service things related to this - // process. + // We keep a count of the number of consecutive exceptions received so we + // know to grab all exceptions without a timeout. We do this to get a bunch + // of related exceptions on our exception port so we can process then + // together. When we have multiple threads, we can get an exception per + // thread and they will come in consecutively. The main loop in this thread + // can stop periodically if needed to service things related to this process. // // [did we lose some words here?] // @@ -338,15 +337,15 @@ // 0 our exception port. After we get one exception, we then will use the // MACH_RCV_TIMEOUT option with a zero timeout to grab all other current // exceptions for our process. After we have received the last pending - // exception, we will get a timeout which enables us to then notify - // our main thread that we have an exception bundle available. We then wait - // for the main thread to tell this exception thread to start trying to get + // exception, we will get a timeout which enables us to then notify our main + // thread that we have an exception bundle available. We then wait for the + // main thread to tell this exception thread to start trying to get // exceptions messages again and we start again with a mach_msg read with // infinite timeout. // // We choose to park a thread on this, rather than polling, because the - // polling is expensive. On devices, we need to minimize overhead caused - // by the process monitor. + // polling is expensive. On devices, we need to minimize overhead caused by + // the process monitor. uint32_t num_exceptions_received = 0; Status error; task_t task = m_task; @@ -359,8 +358,7 @@ CFReleaser watchdog; if (process->ProcessUsingSpringBoard()) { - // Request a renewal for every 60 seconds if we attached using - // SpringBoard. + // Request a renewal for every 60 seconds if we attached using SpringBoard. watchdog.reset(::SBSWatchdogAssertionCreateForPID(nullptr, pid, 60)); if (log) log->Printf("::SBSWatchdogAssertionCreateForPID(NULL, %4.4x, 60) " @@ -401,18 +399,18 @@ } #endif // #ifdef WITH_BKS - // Do we want to use a weak pointer to the NativeProcessDarwin here, in - // which case we can guarantee we don't whack the process monitor if we - // race between this thread and the main one on shutdown? + // Do we want to use a weak pointer to the NativeProcessDarwin here, in which + // case we can guarantee we don't whack the process monitor if we race + // between this thread and the main one on shutdown? while (IsExceptionPortValid()) { ::pthread_testcancel(); MachException::Message exception_message; if (num_exceptions_received > 0) { - // We don't want a timeout here, just receive as many exceptions as - // we can since we already have one. We want to get all currently - // available exceptions for this task at once. + // We don't want a timeout here, just receive as many exceptions as we + // can since we already have one. We want to get all currently available + // exceptions for this task at once. error = exception_message.Receive( GetExceptionPort(), MACH_RCV_MSG | MACH_RCV_INTERRUPT | MACH_RCV_TIMEOUT, 0); @@ -424,8 +422,8 @@ MACH_RCV_TIMEOUT, periodic_timeout); } else { - // We don't need to parse all current exceptions or stop - // periodically, just wait for an exception forever. + // We don't need to parse all current exceptions or stop periodically, + // just wait for an exception forever. error = exception_message.Receive(GetExceptionPort(), MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0); } @@ -462,8 +460,8 @@ __FUNCTION__); continue; } else { - // The inferior task is no longer valid. Time to exit as - // the process has gone away. + // The inferior task is no longer valid. Time to exit as the process + // has gone away. if (log) log->Printf("NativeProcessDarwin::%s(): the inferior task " "has exited, and so will we...", @@ -476,18 +474,17 @@ // We timed out when waiting for exceptions. if (num_exceptions_received > 0) { - // We were receiving all current exceptions with a timeout of - // zero. It is time to go back to our normal looping mode. + // We were receiving all current exceptions with a timeout of zero. + // It is time to go back to our normal looping mode. num_exceptions_received = 0; - // Notify our main thread we have a complete exception message - // bundle available. Get the possibly updated task port back - // from the process in case we exec'ed and our task port - // changed. + // Notify our main thread we have a complete exception message bundle + // available. Get the possibly updated task port back from the + // process in case we exec'ed and our task port changed. task = ExceptionMessageBundleComplete(); - // In case we use a timeout value when getting exceptions, - // make sure our task is still valid. + // In case we use a timeout value when getting exceptions, make sure + // our task is still valid. if (IsTaskValid(task)) { // Task is still ok. if (log) @@ -496,8 +493,8 @@ __FUNCTION__); continue; } else { - // The inferior task is no longer valid. Time to exit as - // the process has gone away. + // The inferior task is no longer valid. Time to exit as the + // process has gone away. if (log) log->Printf("NativeProcessDarwin::%s(): the inferior " "task has exited, and so will we...", @@ -534,10 +531,8 @@ // TODO: change SBSWatchdogAssertionRelease to SBSWatchdogAssertionCancel // when we // all are up and running on systems that support it. The SBS framework has - // a #define - // that will forward SBSWatchdogAssertionRelease to - // SBSWatchdogAssertionCancel for now - // so it should still build either way. + // a #define that will forward SBSWatchdogAssertionRelease to + // SBSWatchdogAssertionCancel for now so it should still build either way. DNBLogThreadedIf(LOG_TASK, "::SBSWatchdogAssertionRelease(%p)", watchdog.get()); ::SBSWatchdogAssertionRelease(watchdog.get()); @@ -728,8 +723,8 @@ const int signo = m_exception_messages[i].state.SoftSignal(); if (signo == SIGTRAP) { // SIGTRAP could mean that we exec'ed. We need to check the - // dyld all_image_infos.infoArray to see if it is NULL and if - // so, say that we exec'ed. + // dyld all_image_infos.infoArray to see if it is NULL and if so, say + // that we exec'ed. const addr_t aii_addr = GetDYLDAllImageInfosAddress(error); if (aii_addr == LLDB_INVALID_ADDRESS) break; @@ -744,12 +739,12 @@ bytes_read); // #bytes read if (read_error.Success() && (bytes_read == 4)) { if (info_array_count == 0) { - // We got the all infos address, and there are zero - // entries. We think we exec'd. + // We got the all infos address, and there are zero entries. We + // think we exec'd. m_did_exec = true; - // Force the task port to update itself in case the - // task port changed after exec + // Force the task port to update itself in case the task port + // changed after exec const task_t old_task = m_task; const bool force_update = true; const task_t new_task = TaskPortForProcessID(error, force_update); @@ -810,8 +805,7 @@ // 4 - We might need to resume if we stopped only with the // interrupt signal that we never handled. if (m_auto_resume_signo != 0) { - // Only auto_resume if we stopped with _only_ the interrupt - // signal. + // Only auto_resume if we stopped with _only_ the interrupt signal. if (num_task_exceptions == 1) { auto_resume = true; if (log) @@ -831,8 +825,8 @@ } } - // Let all threads recover from stopping and do any clean up based - // on the previous thread state (if any). + // Let all threads recover from stopping and do any clean up based on the + // previous thread state (if any). m_thread_list.ProcessDidStop(*this); // Let each thread know of any exceptions @@ -863,8 +857,8 @@ // TODO - need to hook up event system here. !!!! #if 0 // Wait for the eEventProcessRunningStateChanged event to be reset - // before changing state to stopped to avoid race condition with - // very fast start/stops. + // before changing state to stopped to avoid race condition with very + // fast start/stops. struct timespec timeout; //DNBTimer::OffsetTimeOfDay(&timeout, 0, 250 * 1000); // Wait for 250 ms @@ -889,12 +883,12 @@ Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - // Strategy: create a thread that sits on waitpid(), waiting for the - // inferior process to die, reaping it in the process. Arrange for - // the thread to have a pipe file descriptor that it can send a byte - // over when the waitpid completes. Have the main loop have a read - // object for the other side of the pipe, and have the callback for - // the read do the process termination message sending. + // Strategy: create a thread that sits on waitpid(), waiting for the inferior + // process to die, reaping it in the process. Arrange for the thread to have + // a pipe file descriptor that it can send a byte over when the waitpid + // completes. Have the main loop have a read object for the other side of + // the pipe, and have the callback for the read do the process termination + // message sending. // Create a single-direction communication channel. const bool child_inherits = false; @@ -1025,8 +1019,8 @@ } } - // We should never exit as long as our child process is alive. If we - // get here, something completely unexpected went wrong and we should exit. + // We should never exit as long as our child process is alive. If we get + // here, something completely unexpected went wrong and we should exit. if (log) log->Printf( "NativeProcessDarwin::%s(): internal error: waitpid thread " @@ -1157,8 +1151,8 @@ ::usleep(usec_interval); } - // We failed to get the task for the inferior process. - // Ensure that it is cleared out. + // We failed to get the task for the inferior process. Ensure that it is + // cleared out. m_task = TASK_NULL; } return m_task; @@ -1196,9 +1190,9 @@ } // bool stepOverBreakInstruction = step; - // Let the thread prepare to resume and see if any threads want us to - // step over a breakpoint instruction (ProcessWillResume will modify - // the value of stepOverBreakInstruction). + // Let the thread prepare to resume and see if any threads want us to step + // over a breakpoint instruction (ProcessWillResume will modify the value of + // stepOverBreakInstruction). m_thread_list.ProcessWillResume(*this, m_thread_actions); // Set our state accordingly @@ -1254,8 +1248,8 @@ error = message.Reply(m_pid, m_task, thread_reply_signal); if (error.Fail() && log) { - // We log any error here, but we don't stop the exception - // response handling. + // We log any error here, but we don't stop the exception response + // handling. log->Printf("NativeProcessDarwin::%s(): failed to reply to " "exception: %s", __FUNCTION__, error.AsCString()); @@ -1263,8 +1257,8 @@ } } - // Erase all exception message as we should have used and replied - // to them all already. + // Erase all exception message as we should have used and replied to them all + // already. m_exception_messages.clear(); return error; } @@ -1292,8 +1286,8 @@ "0x%4.4x", __FUNCTION__, m_task); - // Get the BasicInfo struct to verify that we're suspended before we try - // to resume the task. + // Get the BasicInfo struct to verify that we're suspended before we try to + // resume the task. struct task_basic_info task_info; error = GetTaskBasicInfo(m_task, &task_info); if (error.Fail()) { @@ -1304,9 +1298,8 @@ return error; } - // task_resume isn't counted like task_suspend calls are, so if the - // task is not suspended, don't try and resume it since it is already - // running + // task_resume isn't counted like task_suspend calls are, so if the task is + // not suspended, don't try and resume it since it is already running if (task_info.suspend_count > 0) { auto mach_err = ::task_resume(m_task); error.SetError(mach_err, eErrorTypeMachKernel); Index: lldb/trunk/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp @@ -30,8 +30,8 @@ (thread_info_t)&tident, &tident_count); if (mach_err != KERN_SUCCESS) { // When we fail to get thread info for the supposed port, assume it is - // really a globally unique thread id already, or return the best thing - // we can, which is the thread port. + // really a globally unique thread id already, or return the best thing we + // can, which is the thread port. return mach_port_id; } return tident.thread_id; @@ -47,9 +47,9 @@ bool NativeThreadDarwin::GetIdentifierInfo() { // Don't try to get the thread info once and cache it for the life of the - // thread. It changes over time, for instance - // if the thread name changes, then the thread_handle also changes... So you - // have to refetch it every time. + // thread. It changes over time, for instance if the thread name changes, + // then the thread_handle also changes... So you have to refetch it every + // time. mach_msg_type_number_t count = THREAD_IDENTIFIER_INFO_COUNT; kern_return_t kret = ::thread_info(m_mach_thread_port, THREAD_IDENTIFIER_INFO, (thread_info_t)&m_ident_info, &count); @@ -137,16 +137,16 @@ // TODO implement this. #if 0 // Allow the arch specific protocol to process (MachException::Data &)exc - // first before possible reassignment of m_stop_exception with exc. - // See also MachThread::GetStopException(). + // first before possible reassignment of m_stop_exception with exc. See + // also MachThread::GetStopException(). bool handled = m_arch_ap->NotifyException(exc); if (m_stop_exception.IsValid()) { // We may have more than one exception for a thread, but we need to - // only remember the one that we will say is the reason we stopped. - // We may have been single stepping and also gotten a signal exception, - // so just remember the most pertinent one. + // only remember the one that we will say is the reason we stopped. We + // may have been single stepping and also gotten a signal exception, so + // just remember the most pertinent one. if (m_stop_exception.IsBreakpoint()) m_stop_exception = exc; } @@ -170,8 +170,8 @@ if (bp) { - // This thread is sitting at a breakpoint, ask the breakpoint - // if we should be stopping here. + // This thread is sitting at a breakpoint, ask the breakpoint if we + // should be stopping here. return true; } else @@ -181,11 +181,10 @@ step_more = true; return false; } - // The thread state is used to let us know what the thread was - // trying to do. MachThread::ThreadWillResume() will set the - // thread state to various values depending if the thread was - // the current thread and if it was to be single stepped, or - // resumed. + // The thread state is used to let us know what the thread was trying + // to do. MachThread::ThreadWillResume() will set the thread state to + // various values depending if the thread was the current thread and if + // it was to be single stepped, or resumed. if (GetState() == eStateRunning) { // If our state is running, then we should continue as we are in @@ -194,8 +193,7 @@ } else { - // Stop if we have any kind of valid exception for this - // thread. + // Stop if we have any kind of valid exception for this thread. if (GetStopException().IsValid()) return true; } @@ -209,17 +207,17 @@ void NativeThreadDarwin::ThreadDidStop() { // TODO implement this. #if 0 - // This thread has existed prior to resuming under debug nub control, - // and has just been stopped. Do any cleanup that needs to be done - // after running. - - // The thread state and breakpoint will still have the same values - // as they had prior to resuming the thread, so it makes it easy to check - // if we were trying to step a thread, or we tried to resume while being - // at a breakpoint. + // This thread has existed prior to resuming under debug nub control, and + // has just been stopped. Do any cleanup that needs to be done after + // running. + + // The thread state and breakpoint will still have the same values as they + // had prior to resuming the thread, so it makes it easy to check if we + // were trying to step a thread, or we tried to resume while being at a + // breakpoint. - // When this method gets called, the process state is still in the - // state it was in while running so we can act accordingly. + // When this method gets called, the process state is still in the state it + // was in while running so we can act accordingly. m_arch_ap->ThreadDidStop(); Index: lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp @@ -308,8 +308,8 @@ __FUNCTION__, process.GetID(), update, process.GetStopID()); if (process.GetStopID() == 0) { - // On our first stop, we'll record details like 32/64 bitness and - // select the proper architecture implementation. + // On our first stop, we'll record details like 32/64 bitness and select + // the proper architecture implementation. // int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)process.GetID()}; @@ -358,9 +358,9 @@ if (thread_list_count > 0) { collection currThreads; size_t idx; - // Iterator through the current thread list and see which threads - // we already have in our list (keep them), which ones we don't - // (add them), and which ones are not around anymore (remove them). + // Iterator through the current thread list and see which threads we + // already have in our list (keep them), which ones we don't (add them), + // and which ones are not around anymore (remove them). for (idx = 0; idx < thread_list_count; ++idx) { // Get the Mach thread port. const ::thread_t mach_port_num = thread_list[idx]; @@ -373,18 +373,18 @@ // Retrieve the thread if it exists. auto thread_sp = GetThreadByID(unique_thread_id); if (thread_sp) { - // We are already tracking it. Keep the existing native - // thread instance. + // We are already tracking it. Keep the existing native thread + // instance. currThreads.push_back(thread_sp); } else { - // We don't have a native thread instance for this thread. - // Create it now. + // We don't have a native thread instance for this thread. Create it + // now. thread_sp.reset(new NativeThreadDarwin( &process, m_is_64_bit, unique_thread_id, mach_port_num)); - // Add the new thread regardless of its is user ready state. - // Make sure the thread is ready to be displayed and shown - // to users before we add this thread to our list... + // Add the new thread regardless of its is user ready state. Make + // sure the thread is ready to be displayed and shown to users before + // we add this thread to our list... if (thread_sp->IsUserReady()) { if (new_threads) new_threads->push_back(thread_sp); @@ -417,9 +417,9 @@ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); if (m_current_thread.get() == NULL) { - // Figure out which thread is going to be our current thread. - // This is currently done by finding the first thread in the list - // that has a valid exception. + // Figure out which thread is going to be our current thread. This is + // currently done by finding the first thread in the list that has a + // valid exception. const size_t num_threads = m_threads.size(); for (uint32_t idx = 0; idx < num_threads; ++idx) { @@ -455,8 +455,8 @@ NativeProcessDarwin &process, const ResumeActionList &thread_actions) { std::lock_guard locker(m_threads_mutex); - // Update our thread list, because sometimes libdispatch or the kernel - // will spawn threads while a task is suspended. + // Update our thread list, because sometimes libdispatch or the kernel will + // spawn threads while a task is suspended. NativeThreadListDarwin::collection new_threads; // TODO implement this. @@ -489,7 +489,8 @@ #if 0 DNBThreadResumeAction resume_new_threads = { -1U, eStateRunning, 0, INVALID_NUB_ADDRESS }; - // If we are planning to run only one thread, any new threads should be suspended. + // If we are planning to run only one thread, any new threads should be + // suspended. if (run_one_thread) resume_new_threads.state = eStateSuspended; @@ -549,11 +550,11 @@ } //---------------------------------------------------------------------- -// Check each thread in our thread list to see if we should notify our -// client of the current halt in execution. +// Check each thread in our thread list to see if we should notify our client +// of the current halt in execution. // -// Breakpoints can have callback functions associated with them than -// can return true to stop, or false to continue executing the inferior. +// Breakpoints can have callback functions associated with them than can return +// true to stop, or false to continue executing the inferior. // // RETURNS // true if we should stop and notify our clients @@ -607,8 +608,9 @@ return false; } -// DNBWatchpointSet() -> MachProcess::CreateWatchpoint() -> MachProcess::EnableWatchpoint() -// -> NativeThreadListDarwin::EnableHardwareWatchpoint(). +// DNBWatchpointSet() -> MachProcess::CreateWatchpoint() -> +// MachProcess::EnableWatchpoint() -> +// NativeThreadListDarwin::EnableHardwareWatchpoint(). uint32_t NativeThreadListDarwin::EnableHardwareWatchpoint (const DNBBreakpoint* wp) const { @@ -617,14 +619,16 @@ { PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); const size_t num_threads = m_threads.size(); - // On Mac OS X we have to prime the control registers for new threads. We do this - // using the control register data for the first thread, for lack of a better way of choosing. + // On Mac OS X we have to prime the control registers for new threads. + // We do this using the control register data for the first thread, for + // lack of a better way of choosing. bool also_set_on_task = true; for (uint32_t idx = 0; idx < num_threads; ++idx) { if ((hw_index = m_threads[idx]->EnableHardwareWatchpoint(wp, also_set_on_task)) == INVALID_NUB_HW_INDEX) { - // We know that idx failed for some reason. Let's rollback the transaction for [0, idx). + // We know that idx failed for some reason. Let's rollback the + // transaction for [0, idx). for (uint32_t i = 0; i < idx; ++i) m_threads[i]->RollbackTransForHWP(); return INVALID_NUB_HW_INDEX; @@ -647,14 +651,16 @@ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); const size_t num_threads = m_threads.size(); - // On Mac OS X we have to prime the control registers for new threads. We do this - // using the control register data for the first thread, for lack of a better way of choosing. + // On Mac OS X we have to prime the control registers for new threads. + // We do this using the control register data for the first thread, for + // lack of a better way of choosing. bool also_set_on_task = true; for (uint32_t idx = 0; idx < num_threads; ++idx) { if (!m_threads[idx]->DisableHardwareWatchpoint(wp, also_set_on_task)) { - // We know that idx failed for some reason. Let's rollback the transaction for [0, idx). + // We know that idx failed for some reason. Let's rollback the + // transaction for [0, idx). for (uint32_t i = 0; i < idx; ++i) m_threads[i]->RollbackTransForHWP(); return false; @@ -675,7 +681,8 @@ { PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex); const size_t num_threads = m_threads.size(); - // Use an arbitrary thread to retrieve the number of supported hardware watchpoints. + // Use an arbitrary thread to retrieve the number of supported hardware + // watchpoints. if (num_threads) return m_threads[0]->NumSupportedHardwareWatchpoints(); return 0; Index: lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp @@ -69,15 +69,15 @@ for (uint32_t wp_idx = 0; wp_idx < wp_size; wp_idx++) { lldb::WatchpointSP wp = wp_list.GetByIndex(wp_idx); if (wp.get() && wp->IsEnabled()) { - // This watchpoint as been enabled; obviously this "new" thread - // has been created since that watchpoint was enabled. Since - // the POSIXBreakpointProtocol has yet to be initialized, its - // m_watchpoints_initialized member will be FALSE. Attempting to - // read the debug status register to determine if a watchpoint - // has been hit would result in the zeroing of that register. - // Since the active debug registers would have been cloned when - // this thread was created, simply force the m_watchpoints_initized - // member to TRUE and avoid resetting dr6 and dr7. + // This watchpoint as been enabled; obviously this "new" thread has been + // created since that watchpoint was enabled. Since the + // POSIXBreakpointProtocol has yet to be initialized, its + // m_watchpoints_initialized member will be FALSE. Attempting to read + // the debug status register to determine if a watchpoint has been hit + // would result in the zeroing of that register. Since the active debug + // registers would have been cloned when this thread was created, simply + // force the m_watchpoints_initized member to TRUE and avoid resetting + // dr6 and dr7. GetPOSIXBreakpointProtocol()->ForceWatchpointsInitialized(); } } @@ -98,9 +98,8 @@ // context by the time this function gets called. The KDPRegisterContext // class has been made smart enough to detect when it needs to invalidate // which registers are valid by putting hooks in the register read and - // register supply functions where they check the process stop ID and do - // the right thing. - // if (StateIsStoppedState(GetState()) + // register supply functions where they check the process stop ID and do the + // right thing. if (StateIsStoppedState(GetState()) { const bool force = false; GetRegisterContext()->InvalidateIfNeeded(force); @@ -469,20 +468,17 @@ GetProcess()->GetBreakpointSiteList().FindByAddress(pc)); // If the breakpoint is for this thread, then we'll report the hit, but if it - // is for another thread, - // we create a stop reason with should_stop=false. If there is no breakpoint - // location, then report - // an invalid stop reason. We don't need to worry about stepping over the - // breakpoint here, that will - // be taken care of when the thread resumes and notices that there's a + // is for another thread, we create a stop reason with should_stop=false. If + // there is no breakpoint location, then report an invalid stop reason. We + // don't need to worry about stepping over the breakpoint here, that will be + // taken care of when the thread resumes and notices that there's a // breakpoint under the pc. if (bp_site) { lldb::break_id_t bp_id = bp_site->GetID(); // If we have an operating system plug-in, we might have set a thread - // specific breakpoint using the - // operating system thread ID, so we can't make any assumptions about the - // thread ID so we must always - // report the breakpoint regardless of the thread. + // specific breakpoint using the operating system thread ID, so we can't + // make any assumptions about the thread ID so we must always report the + // breakpoint regardless of the thread. if (bp_site->ValidForThisThread(this) || GetProcess()->GetOperatingSystem() != NULL) SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID(*this, bp_id)); @@ -541,13 +537,12 @@ lldb::BreakpointSiteSP bp_site( GetProcess()->GetBreakpointSiteList().FindByAddress(pc)); - // If the current pc is a breakpoint site then set the StopInfo to Breakpoint. - // Otherwise, set the StopInfo to Watchpoint or Trace. - // If we have an operating system plug-in, we might have set a thread specific - // breakpoint using the - // operating system thread ID, so we can't make any assumptions about the - // thread ID so we must always - // report the breakpoint regardless of the thread. + // If the current pc is a breakpoint site then set the StopInfo to + // Breakpoint. Otherwise, set the StopInfo to Watchpoint or Trace. If we have + // an operating system plug-in, we might have set a thread specific + // breakpoint using the operating system thread ID, so we can't make any + // assumptions about the thread ID so we must always report the breakpoint + // regardless of the thread. if (bp_site && (bp_site->ValidForThisThread(this) || GetProcess()->GetOperatingSystem() != NULL)) SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID( Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -357,10 +357,10 @@ if (file_action && file_action->GetAction() == FileAction::eFileActionOpen) { file_spec = file_action->GetFileSpec(); - // By default the stdio paths passed in will be pseudo-terminal - // (/dev/pts). If so, convert to using a different default path - // instead to redirect I/O to the debugger console. This should - // also handle user overrides to /dev/null or a different file. + // By default the stdio paths passed in will be pseudo-terminal (/dev/pts). + // If so, convert to using a different default path instead to redirect I/O + // to the debugger console. This should also handle user overrides to + // /dev/null or a different file. if (!file_spec || file_spec == dbg_pts_file_spec) file_spec = default_file_spec; } @@ -655,8 +655,8 @@ break; case llvm::Triple::arm: { - // The ARM reference recommends the use of 0xe7fddefe and 0xdefe - // but the linux kernel does otherwise. + // The ARM reference recommends the use of 0xe7fddefe and 0xdefe but the + // linux kernel does otherwise. static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7}; static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde}; @@ -744,8 +744,8 @@ wp->SetEnabled(true, notify); return error; } else { - // Watchpoint enabling failed on at least one - // of the threads so roll back all of them + // Watchpoint enabling failed on at least one of the threads so roll + // back all of them DisableWatchpoint(wp, false); error.SetErrorString("Setting hardware watchpoint failed"); } @@ -812,8 +812,8 @@ Status ProcessFreeBSD::GetWatchpointSupportInfo(uint32_t &num, bool &after) { Status error = GetWatchpointSupportInfo(num); - // Watchpoints trigger and halt the inferior after - // the corresponding instruction has been executed. + // Watchpoints trigger and halt the inferior after the corresponding + // instruction has been executed. after = true; return error; } @@ -1076,8 +1076,8 @@ "Emulation was successful but PC wasn't updated"); next_pc = pc_it->second.GetAsUInt64(); } else if (pc_it == baton.m_register_values.end()) { - // Emulate instruction failed and it haven't changed PC. Advance PC - // with the size of the current opcode because the emulation of all + // Emulate instruction failed and it haven't changed PC. Advance PC with + // the size of the current opcode because the emulation of all // PC modifying instruction should be successful. The failure most // likely caused by a not supported instruction which don't modify PC. next_pc = Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp @@ -41,8 +41,8 @@ using namespace lldb; using namespace lldb_private; -// We disable the tracing of ptrace calls for integration builds to -// avoid the additional indirection and checks. +// We disable the tracing of ptrace calls for integration builds to avoid the +// additional indirection and checks. #ifndef LLDB_CONFIGURATION_BUILDANDINTEGRATION // Wrapper for ptrace to catch errors and log calls. @@ -61,9 +61,8 @@ } } -// Wrapper for ptrace to catch errors and log calls. -// Note that ptrace sets errno on error because -1 is reserved as a valid -// result. +// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets +// errno on error because -1 is reserved as a valid result. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data, const char *reqName, const char *file, int line) { long int result; @@ -130,8 +129,8 @@ return result; } -// Wrapper for ptrace when logging is not required. -// Sets errno to 0 prior to calling ptrace. +// Wrapper for ptrace when logging is not required. Sets errno to 0 prior to +// calling ptrace. extern long PtraceWrapper(int req, lldb::pid_t pid, void *addr, int data) { long result = 0; errno = 0; @@ -875,9 +874,9 @@ if (PTRACE(PT_TRACE_ME, 0, NULL, 0) < 0) exit(ePtraceFailed); - // terminal has already dupped the tty descriptors to stdin/out/err. - // This closes original fd from which they were copied (and avoids - // leaking descriptors to the debugged process. + // terminal has already dupped the tty descriptors to stdin/out/err. This + // closes original fd from which they were copied (and avoids leaking + // descriptors to the debugged process. terminal.CloseSlaveFileDescriptor(); // Do not inherit setgid powers. @@ -1102,9 +1101,9 @@ break; case (SIGTRAP /* | (PTRACE_EVENT_EXIT << 8) */): { - // The inferior process is about to exit. Maintain the process in a - // state of "limbo" until we are explicitly commanded to detach, - // destroy, resume, etc. + // The inferior process is about to exit. Maintain the process in a state + // of "limbo" until we are explicitly commanded to detach, destroy, resume, + // etc. unsigned long data = 0; if (!monitor->GetEventMessage(tid, &data)) data = -1; @@ -1159,8 +1158,8 @@ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // POSIX says that process behaviour is undefined after it ignores a SIGFPE, - // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a - // kill(2) or raise(3). Similarly for tgkill(2) on FreeBSD. + // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2) + // or raise(3). Similarly for tgkill(2) on FreeBSD. // // IOW, user generated signals never generate what we consider to be a // "crash". @@ -1196,8 +1195,8 @@ } // else; Use atleast si_signo info for other si_code } - // Everything else is "normal" and does not require any special action on - // our part. + // Everything else is "normal" and does not require any special action on our + // part. return ProcessMessage::Signal(tid, signo); } @@ -1423,14 +1422,14 @@ } // FIXME: On Linux, when a new thread is created, we receive to notifications, -// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the -// child thread id as additional information, and (2) a SIGSTOP|SI_USER from -// the new child thread indicating that it has is stopped because we attached. -// We have no guarantee of the order in which these arrive, but we need both -// before we are ready to proceed. We currently keep a list of threads which -// have sent the initial SIGSTOP|SI_USER event. Then when we receive the -// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not occurred -// we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. +// (1) a SIGTRAP|PTRACE_EVENT_CLONE from the main process thread with the child +// thread id as additional information, and (2) a SIGSTOP|SI_USER from the new +// child thread indicating that it has is stopped because we attached. We have +// no guarantee of the order in which these arrive, but we need both before we +// are ready to proceed. We currently keep a list of threads which have sent +// the initial SIGSTOP|SI_USER event. Then when we receive the +// SIGTRAP|PTRACE_EVENT_CLONE notification, if the initial stop has not +// occurred we call ProcessMonitor::WaitForInitialTIDStop() to wait for it. // // Right now, the above logic is in ProcessPOSIX, so we need a definition of // this function in the FreeBSD ProcessMonitor implementation even if it isn't Index: lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_mips64.cpp @@ -130,14 +130,14 @@ bool success = ReadRegister(full_reg, value); if (success) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) value.SetUInt64(value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } Index: lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_powerpc.cpp @@ -140,8 +140,8 @@ if (success) { // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } Index: lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp @@ -193,14 +193,14 @@ bool success = ReadRegister(full_reg, value); if (success) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) value.SetUInt64(value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (value.GetByteSize() > reg_info->byte_size) value.SetType(reg_info); } @@ -221,7 +221,8 @@ value.SetBytes(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, reg_info->byte_size, byte_order); if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) { - // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes + // Concatenate ymm using the register halves in xmm.bytes and + // ymmh.bytes if (GetFPRType() == eXSAVE && CopyXSTATEtoYMM(reg, byte_order)) value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, reg_info->byte_size, byte_order); @@ -233,11 +234,10 @@ return false; } - // Get pointer to m_fpr.fxsave variable and set the data from it. - // Byte offsets of all registers are calculated wrt 'UserArea' structure. - // However, ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)} - // and stores them in 'm_fpr' (of type FPR structure). To extract values of - // fpu + // Get pointer to m_fpr.fxsave variable and set the data from it. Byte + // offsets of all registers are calculated wrt 'UserArea' structure. However, + // ReadFPR() reads fpu registers {using ptrace(PT_GETFPREGS,..)} and stores + // them in 'm_fpr' (of type FPR structure). To extract values of fpu // registers, m_fpr should be read at byte offsets calculated wrt to FPR // structure. @@ -299,12 +299,12 @@ return false; } } else { - // Get pointer to m_fpr.fxsave variable and set the data to it. - // Byte offsets of all registers are calculated wrt 'UserArea' structure. - // However, WriteFPR() takes m_fpr (of type FPR structure) and writes only - // fpu - // registers using ptrace(PT_SETFPREGS,..) API. Hence fpu registers should - // be written in m_fpr at byte offsets calculated wrt FPR structure. + // Get pointer to m_fpr.fxsave variable and set the data to it. Byte + // offsets of all registers are calculated wrt 'UserArea' structure. + // However, WriteFPR() takes m_fpr (of type FPR structure) and writes + // only fpu registers using ptrace(PT_SETFPREGS,..) API. Hence fpu + // registers should be written in m_fpr at byte offsets calculated wrt + // FPR structure. // Since, FPR structure is also one of the member of UserArea structure. // byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - Index: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -337,8 +337,8 @@ // Attach to the requested process. // An attach will cause the thread to stop with a SIGSTOP. if ((status = PtraceWrapper(PTRACE_ATTACH, tid)).Fail()) { - // No such thread. The thread may have exited. - // More error handling may be needed. + // No such thread. The thread may have exited. More error handling + // may be needed. if (status.GetError() == ESRCH) { it = tids_to_attach.erase(it); continue; @@ -348,11 +348,11 @@ int wpid = llvm::sys::RetryAfterSignal(-1, ::waitpid, tid, nullptr, __WALL); - // Need to use __WALL otherwise we receive an error with errno=ECHLD - // At this point we should have a thread stopped if waitpid succeeds. + // Need to use __WALL otherwise we receive an error with errno=ECHLD At + // this point we should have a thread stopped if waitpid succeeds. if (wpid < 0) { - // No such thread. The thread may have exited. - // More error handling may be needed. + // No such thread. The thread may have exited. More error handling + // may be needed. if (errno == ESRCH) { it = tids_to_attach.erase(it); continue; @@ -397,8 +397,8 @@ // appropriate ptrace flags here (PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK) ptrace_opts |= PTRACE_O_TRACECLONE; - // Have the tracer notify us before execve returns - // (needed to disable legacy SIGTRAP generation) + // Have the tracer notify us before execve returns (needed to disable legacy + // SIGTRAP generation) ptrace_opts |= PTRACE_O_TRACEEXEC; return PtraceWrapper(PTRACE_SETOPTIONS, pid, nullptr, (void *)ptrace_opts); @@ -438,8 +438,8 @@ auto thread_sp = GetThreadByID(pid); if (!thread_sp) { - // Normally, the only situation when we cannot find the thread is if we have - // just received a new thread notification. This is indicated by + // Normally, the only situation when we cannot find the thread is if we + // have just received a new thread notification. This is indicated by // GetSignalInfo() returning si_code == SI_USER and si_pid == 0 LLDB_LOG(log, "received notification about an unknown tid {0}.", pid); @@ -471,15 +471,15 @@ MonitorSignal(info, *thread_sp, exited); } else { if (info_err.GetError() == EINVAL) { - // This is a group stop reception for this tid. - // We can reach here if we reinject SIGSTOP, SIGSTP, SIGTTIN or SIGTTOU - // into the tracee, triggering the group-stop mechanism. Normally - // receiving these would stop the process, pending a SIGCONT. Simulating - // this state in a debugger is hard and is generally not needed (one use - // case is debugging background task being managed by a shell). For - // general use, it is sufficient to stop the process in a signal-delivery - // stop which happens before the group stop. This done by MonitorSignal - // and works correctly for all signals. + // This is a group stop reception for this tid. We can reach here if we + // reinject SIGSTOP, SIGSTP, SIGTTIN or SIGTTOU into the tracee, + // triggering the group-stop mechanism. Normally receiving these would + // stop the process, pending a SIGCONT. Simulating this state in a + // debugger is hard and is generally not needed (one use case is + // debugging background task being managed by a shell). For general use, + // it is sufficient to stop the process in a signal-delivery stop which + // happens before the group stop. This done by MonitorSignal and works + // correctly for all signals. LLDB_LOG(log, "received a group stop for pid {0} tid {1}. Transparent " "handling of group stops not supported, resuming the " @@ -505,8 +505,8 @@ if (is_main_thread) { // Notify the delegate - our process is not available but appears to - // have been killed outside - // our control. Is eStateExited the right exit state in this case? + // have been killed outside our control. Is eStateExited the right + // exit state in this case? SetExitStatus(status, true); SetState(StateType::eStateExited, true); } else { @@ -575,19 +575,14 @@ switch (info.si_code) { // TODO: these two cases are required if we want to support tracing of the - // inferiors' children. We'd need this to debug a monitor. - // case (SIGTRAP | (PTRACE_EVENT_FORK << 8)): - // case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)): + // inferiors' children. We'd need this to debug a monitor. case (SIGTRAP | + // (PTRACE_EVENT_FORK << 8)): case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)): case (SIGTRAP | (PTRACE_EVENT_CLONE << 8)): { // This is the notification on the parent thread which informs us of new - // thread - // creation. - // We don't want to do anything with the parent thread so we just resume it. - // In case we - // want to implement "break on thread creation" functionality, we would need - // to stop - // here. + // thread creation. We don't want to do anything with the parent thread so + // we just resume it. In case we want to implement "break on thread + // creation" functionality, we would need to stop here. unsigned long event_message = 0; if (GetEventMessage(thread.GetID(), &event_message).Fail()) { @@ -637,10 +632,10 @@ } case (SIGTRAP | (PTRACE_EVENT_EXIT << 8)): { - // The inferior process or one of its threads is about to exit. - // We don't want to do anything with the thread so we just resume it. In - // case we want to implement "break on thread exit" functionality, we would - // need to stop here. + // The inferior process or one of its threads is about to exit. We don't + // want to do anything with the thread so we just resume it. In case we + // want to implement "break on thread exit" functionality, we would need to + // stop here. unsigned long data = 0; if (GetEventMessage(thread.GetID(), &data).Fail()) @@ -658,8 +653,8 @@ // Due to a kernel bug, we may sometimes get this stop after the inferior // gets a SIGKILL. This confuses our state tracking logic in // ResumeThread(), since normally, we should not be receiving any ptrace - // events while the inferior is stopped. This makes sure that the inferior - // is resumed and exits normally. + // events while the inferior is stopped. This makes sure that the + // inferior is resumed and exits normally. state = eStateRunning; } ResumeThread(thread, state, LLDB_INVALID_SIGNAL_NUMBER); @@ -705,8 +700,8 @@ case SI_KERNEL: #if defined __mips__ - // For mips there is no special signal for watchpoint - // So we check for watchpoint in kernel trap + // For mips there is no special signal for watchpoint So we check for + // watchpoint in kernel trap { // If a watchpoint was hit, report it uint32_t wp_index; @@ -782,8 +777,8 @@ LLDB_LOG(log, "received watchpoint event, pid = {0}, wp_index = {1}", thread.GetID(), wp_index); - // Mark the thread as stopped at watchpoint. - // The address is at (lldb::addr_t)info->si_addr if we need it. + // Mark the thread as stopped at watchpoint. The address is at + // (lldb::addr_t)info->si_addr if we need it. thread.SetStoppedByWatchpoint(wp_index); // We need to tell all other running threads before we notify the delegate @@ -799,8 +794,8 @@ Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); // POSIX says that process behaviour is undefined after it ignores a SIGFPE, - // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a - // kill(2) or raise(3). Similarly for tgkill(2) on Linux. + // SIGILL, SIGSEGV, or SIGBUS *unless* that signal was generated by a kill(2) + // or raise(3). Similarly for tgkill(2) on Linux. // // IOW, user generated signals never generate what we consider to be a // "crash". @@ -819,22 +814,22 @@ // This is a tgkill()-based stop. LLDB_LOG(log, "pid {0} tid {1}, thread stopped", GetID(), thread.GetID()); - // Check that we're not already marked with a stop reason. - // Note this thread really shouldn't already be marked as stopped - if we - // were, that would imply that the kernel signaled us with the thread - // stopping which we handled and marked as stopped, and that, without an - // intervening resume, we received another stop. It is more likely that we - // are missing the marking of a run state somewhere if we find that the - // thread was marked as stopped. + // Check that we're not already marked with a stop reason. Note this thread + // really shouldn't already be marked as stopped - if we were, that would + // imply that the kernel signaled us with the thread stopping which we + // handled and marked as stopped, and that, without an intervening resume, + // we received another stop. It is more likely that we are missing the + // marking of a run state somewhere if we find that the thread was marked + // as stopped. const StateType thread_state = thread.GetState(); if (!StateIsStoppedState(thread_state, false)) { // An inferior thread has stopped because of a SIGSTOP we have sent it. // Generally, these are not important stops and we don't want to report // them as they are just used to stop other threads when one thread (the // one with the *real* stop reason) hits a breakpoint (watchpoint, - // etc...). However, in the case of an asynchronous Interrupt(), this *is* - // the real stop reason, so we leave the signal intact if this is the - // thread that was chosen as the triggering thread. + // etc...). However, in the case of an asynchronous Interrupt(), this + // *is* the real stop reason, so we leave the signal intact if this is + // the thread that was chosen as the triggering thread. if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID) { if (m_pending_notification_tid == thread.GetID()) thread.SetStoppedBySignal(SIGSTOP, &info); @@ -863,8 +858,8 @@ return; } - // Check if debugger should stop at this signal or just ignore it - // and resume the inferior. + // Check if debugger should stop at this signal or just ignore it and resume + // the inferior. if (m_signals_to_ignore.find(signo) != m_signals_to_ignore.end()) { ResumeThread(thread, thread.GetState(), signo); return; @@ -915,9 +910,9 @@ return true; } - // The emulator only fill in the dwarf regsiter numbers (and in some case - // the generic register numbers). Get the full register info from the - // register context based on the dwarf register numbers. + // The emulator only fill in the dwarf regsiter numbers (and in some case the + // generic register numbers). Get the full register info from the register + // context based on the dwarf register numbers. const RegisterInfo *full_reg_info = emulator_baton->m_reg_context.GetRegisterInfo( eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]); @@ -1001,8 +996,8 @@ else next_flags = ReadFlags(register_context); } else if (pc_it == baton.m_register_values.end()) { - // Emulate instruction failed and it haven't changed PC. Advance PC - // with the size of the current opcode because the emulation of all + // Emulate instruction failed and it haven't changed PC. Advance PC with + // the size of the current opcode because the emulation of all // PC modifying instruction should be successful. The failure most // likely caused by a not supported instruction which don't modify PC. next_pc = register_context.GetPC() + emulator_ap->GetOpcode().GetByteSize(); @@ -1033,8 +1028,8 @@ error = SetSoftwareBreakpoint(next_pc, 0); } - // If setting the breakpoint fails because next_pc is out of - // the address space, ignore it and let the debugee segfault. + // If setting the breakpoint fails because next_pc is out of the address + // space, ignore it and let the debugee segfault. if (error.GetError() == EIO || error.GetError() == EFAULT) { return Status(); } else if (error.Fail()) @@ -1165,8 +1160,8 @@ } Status NativeProcessLinux::Interrupt() { - // Pick a running thread (or if none, a not-dead stopped thread) as - // the chosen thread that will be the stop-reason thread. + // Pick a running thread (or if none, a not-dead stopped thread) as the + // chosen thread that will be the stop-reason thread. Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); NativeThreadProtocol *running_thread = nullptr; @@ -1174,15 +1169,15 @@ LLDB_LOG(log, "selecting running thread for interrupt target"); for (const auto &thread : m_threads) { - // If we have a running or stepping thread, we'll call that the - // target of the interrupt. + // If we have a running or stepping thread, we'll call that the target of + // the interrupt. const auto thread_state = thread->GetState(); if (thread_state == eStateRunning || thread_state == eStateStepping) { running_thread = thread.get(); break; } else if (!stopped_thread && StateIsStoppedState(thread_state, true)) { - // Remember the first non-dead stopped thread. We'll use that as a backup - // if there are no running threads. + // Remember the first non-dead stopped thread. We'll use that as a + // backup if there are no running threads. stopped_thread = thread.get(); } } @@ -1251,9 +1246,8 @@ StringExtractor line_extractor(maps_line); // Format: {address_start_hex}-{address_end_hex} perms offset dev inode - // pathname - // perms: rwxp (letter is present if set, '-' if not, final character is - // p=private, s=shared). + // pathname perms: rwxp (letter is present if set, '-' if not, final + // character is p=private, s=shared). // Parse out the starting address lldb::addr_t start_address = line_extractor.GetHexMaxU64(false, 0); @@ -1334,8 +1328,8 @@ // the virtual address space, // with no perms if it is not mapped. - // Use an approach that reads memory regions from /proc/{pid}/maps. - // Assume proc maps entries are in ascending order. + // Use an approach that reads memory regions from /proc/{pid}/maps. Assume + // proc maps entries are in ascending order. // FIXME assert if we find differently. if (m_supports_mem_region == LazyBool::eLazyBoolNo) { @@ -1386,10 +1380,8 @@ } // If we made it here, we didn't find an entry that contained the given - // address. Return the - // load_addr as start and the amount of bytes betwwen load address and the end - // of the memory as - // size. + // address. Return the load_addr as start and the amount of bytes betwwen + // load address and the end of the memory as size. range_info.GetRange().SetRangeBase(load_addr); range_info.GetRange().SetRangeEnd(LLDB_INVALID_ADDRESS); range_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo); @@ -1434,8 +1426,8 @@ if (m_mem_region_cache.empty()) { // No entries after attempting to read them. This shouldn't happen if - // /proc/{pid}/maps is supported. Assume we don't support map entries - // via procfs. + // /proc/{pid}/maps is supported. Assume we don't support map entries via + // procfs. m_supports_mem_region = LazyBool::eLazyBoolNo; LLDB_LOG(log, "failed to find any procfs maps entries, assuming no support " @@ -1462,8 +1454,8 @@ Status NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) { // FIXME implementing this requires the equivalent of -// InferiorCallPOSIX::InferiorCallMmap, which depends on -// functional ThreadPlans working with Native*Protocol. +// InferiorCallPOSIX::InferiorCallMmap, which depends on functional ThreadPlans +// working with Native*Protocol. #if 1 return Status("not implemented yet"); #else @@ -1478,8 +1470,7 @@ prot |= eMmapProtExec; // TODO implement this directly in NativeProcessLinux - // (and lift to NativeProcessPOSIX if/when that class is - // refactored out). + // (and lift to NativeProcessPOSIX if/when that class is refactored out). if (InferiorCallMmap(this, addr, 0, size, prot, eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0)) { m_addr_to_mmap_size[addr] = size; @@ -1505,10 +1496,9 @@ } size_t NativeProcessLinux::UpdateThreads() { - // The NativeProcessLinux monitoring threads are always up to date - // with respect to thread state and they keep the thread list - // populated properly. All this method needs to do is return the - // thread count. + // The NativeProcessLinux monitoring threads are always up to date with + // respect to thread state and they keep the thread list populated properly. + // All this method needs to do is return the thread count. return m_threads.size(); } @@ -1647,9 +1637,9 @@ assert(false && "unexpected si_code for SIGSEGV"); break; case SI_KERNEL: - // Linux will occasionally send spurious SI_KERNEL codes. - // (this is poorly documented in sigaction) - // One way to get this is via unaligned SIMD loads. + // Linux will occasionally send spurious SI_KERNEL codes. (this is + // poorly documented in sigaction) One way to get this is via unaligned + // SIMD loads. reason = ProcessMessage::eInvalidAddress; // for lack of anything better break; case SEGV_MAPERR: @@ -1785,8 +1775,7 @@ size_t &bytes_read) { if (ProcessVmReadvSupported()) { // The process_vm_readv path is about 50 times faster than ptrace api. We - // want to use - // this syscall if it is supported. + // want to use this syscall if it is supported. const ::pid_t pid = GetID(); @@ -2093,12 +2082,11 @@ Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); LLDB_LOG(log, "tid: {0}", thread.GetID()); - // Before we do the resume below, first check if we have a pending - // stop notification that is currently waiting for - // all threads to stop. This is potentially a buggy situation since - // we're ostensibly waiting for threads to stop before we send out the - // pending notification, and here we are resuming one before we send - // out the pending stop notification. + // Before we do the resume below, first check if we have a pending stop + // notification that is currently waiting for all threads to stop. This is + // potentially a buggy situation since we're ostensibly waiting for threads + // to stop before we send out the pending notification, and here we are + // resuming one before we send out the pending stop notification. if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID) { LLDB_LOG(log, "about to resume tid {0} per explicit request but we have a " @@ -2107,8 +2095,8 @@ thread.GetID(), m_pending_notification_tid); } - // Request a resume. We expect this to be synchronous and the system - // to reflect it is running after this completes. + // Request a resume. We expect this to be synchronous and the system to + // reflect it is running after this completes. switch (state) { case eStateRunning: { const auto resume_result = thread.Resume(signo); @@ -2137,8 +2125,8 @@ m_pending_notification_tid = triggering_tid; - // Request a stop for all the thread stops that need to be stopped - // and are not already known to be stopped. + // Request a stop for all the thread stops that need to be stopped and are + // not already known to be stopped. for (const auto &thread : m_threads) { if (StateIsRunningState(thread->GetState())) static_cast(thread.get())->RequestStop(); @@ -2184,8 +2172,7 @@ if (m_pending_notification_tid != LLDB_INVALID_THREAD_ID && StateIsRunningState(thread.GetState())) { // We will need to wait for this new thread to stop as well before firing - // the - // notification. + // the notification. thread.RequestStop(); } } @@ -2221,9 +2208,8 @@ } } -// Wrapper for ptrace to catch errors and log calls. -// Note that ptrace sets errno on error because -1 can be a valid result (i.e. -// for PTRACE_PEEK*) +// Wrapper for ptrace to catch errors and log calls. Note that ptrace sets +// errno on error because -1 can be a valid result (i.e. for PTRACE_PEEK*) Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr, void *data, size_t data_size, long *result) { @@ -2421,8 +2407,8 @@ } if (iter->second->GetTraceID() == m_pt_proces_trace_id) { - // traceid maps to the whole process so we have to erase it from the - // thread group. + // traceid maps to the whole process so we have to erase it from the thread + // group. LLDB_LOG(log, "traceid maps to process"); m_pt_traced_thread_group.erase(thread); } @@ -2473,8 +2459,8 @@ if (thread == LLDB_INVALID_THREAD_ID) { for (auto& iter : m_processor_trace_monitor) { if (iter.second->GetTraceID() == traceid) { - // Stopping a trace instance for an individual thread - // hence there will only be one traceid that can match. + // Stopping a trace instance for an individual thread hence there will + // only be one traceid that can match. m_processor_trace_monitor.erase(iter.first); return error; } @@ -2504,8 +2490,8 @@ LLDB_LOG(log, "UID - {0} , Thread -{1}", traceid, thread); if (traceid == m_pt_proces_trace_id) { - // traceid maps to the whole process so we have to erase it from the - // thread group. + // traceid maps to the whole process so we have to erase it from the thread + // group. LLDB_LOG(log, "traceid maps to process"); m_pt_traced_thread_group.erase(thread); } Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp @@ -184,14 +184,14 @@ error = ReadRegisterRaw(full_reg, reg_value); if (error.Success()) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (reg_value.GetByteSize() > reg_info->byte_size) reg_value.SetType(reg_info); } @@ -558,8 +558,8 @@ uint32_t control_value = 0, wp_index = 0, addr_word_offset = 0, byte_mask = 0; lldb::addr_t real_addr = addr; - // Check if we are setting watchpoint other than read/write/access - // Also update watchpoint flag to match Arm write-read bit configuration. + // Check if we are setting watchpoint other than read/write/access Also + // update watchpoint flag to match Arm write-read bit configuration. switch (watch_flags) { case 1: watch_flags = 2; @@ -579,9 +579,9 @@ if (size == 0 || size > 4) return LLDB_INVALID_INDEX32; - // Check 4-byte alignment for hardware watchpoint target address. - // Below is a hack to recalculate address and size in order to - // make sure we can watch non 4-byte alligned addresses as well. + // Check 4-byte alignment for hardware watchpoint target address. Below is a + // hack to recalculate address and size in order to make sure we can watch + // non 4-byte alligned addresses as well. if (addr & 0x03) { uint8_t watch_mask = (addr & 0x03) + size; @@ -874,12 +874,10 @@ uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value) { // PTRACE_PEEKUSER don't work in the aarch64 linux kernel used on android - // devices (always return - // "Bad address"). To avoid using PTRACE_PEEKUSER we read out the full GPR - // register set instead. - // This approach is about 4 times slower but the performance overhead is - // negligible in - // comparision to processing time in lldb-server. + // devices (always return "Bad address"). To avoid using PTRACE_PEEKUSER we + // read out the full GPR register set instead. This approach is about 4 times + // slower but the performance overhead is negligible in comparision to + // processing time in lldb-server. assert(offset % 4 == 0 && "Try to write a register with unaligned offset"); if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm)) return Status("Register isn't fit into the size of the GPR area"); @@ -895,13 +893,10 @@ Status NativeRegisterContextLinux_arm::DoWriteRegisterValue( uint32_t offset, const char *reg_name, const RegisterValue &value) { // PTRACE_POKEUSER don't work in the aarch64 linux kernel used on android - // devices (always return - // "Bad address"). To avoid using PTRACE_POKEUSER we read out the full GPR - // register set, modify - // the requested register and write it back. This approach is about 4 times - // slower but the - // performance overhead is negligible in comparision to processing time in - // lldb-server. + // devices (always return "Bad address"). To avoid using PTRACE_POKEUSER we + // read out the full GPR register set, modify the requested register and + // write it back. This approach is about 4 times slower but the performance + // overhead is negligible in comparision to processing time in lldb-server. assert(offset % 4 == 0 && "Try to write a register with unaligned offset"); if (offset + sizeof(uint32_t) > sizeof(m_gpr_arm)) return Status("Register isn't fit into the size of the GPR area"); @@ -915,9 +910,8 @@ // will clear thumb bit of new PC if we are already in thumb mode; that is // CPSR thumb mode bit is set. if (offset / sizeof(uint32_t) == gpr_pc_arm) { - // Check if we are already in thumb mode and - // thumb bit of current PC is read out to be zero and - // thumb bit of next PC is read out to be one. + // Check if we are already in thumb mode and thumb bit of current PC is + // read out to be zero and thumb bit of next PC is read out to be one. if ((m_gpr_arm[gpr_cpsr_arm] & 0x20) && !(m_gpr_arm[gpr_pc_arm] & 0x01) && (value.GetAsUInt32() & 0x01)) { reg_value &= (~1ull); Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp @@ -28,8 +28,7 @@ #include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h" // System includes - They have to be included after framework includes because -// they define some -// macros which collide with variable names in other modules +// they define some macros which collide with variable names in other modules #include // NT_PRSTATUS and NT_FPREGSET definition #include @@ -207,14 +206,14 @@ error = ReadRegisterRaw(full_reg, reg_value); if (error.Success()) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (reg_value.GetByteSize() > reg_info->byte_size) reg_value.SetType(reg_info); } @@ -562,8 +561,8 @@ uint32_t control_value = 0, wp_index = 0; lldb::addr_t real_addr = addr; - // Check if we are setting watchpoint other than read/write/access - // Also update watchpoint flag to match AArch64 write-read bit configuration. + // Check if we are setting watchpoint other than read/write/access Also + // update watchpoint flag to match AArch64 write-read bit configuration. switch (watch_flags) { case 1: watch_flags = 2; @@ -581,9 +580,9 @@ if (size != 1 && size != 2 && size != 4 && size != 8) return LLDB_INVALID_INDEX32; - // Check 8-byte alignment for hardware watchpoint target address. - // Below is a hack to recalculate address and size in order to - // make sure we can watch non 8-byte alligned addresses as well. + // Check 8-byte alignment for hardware watchpoint target address. Below is a + // hack to recalculate address and size in order to make sure we can watch + // non 8-byte alligned addresses as well. if (addr & 0x07) { uint8_t watch_mask = (addr & 0x07) + size; Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_mips64.cpp @@ -140,9 +140,9 @@ break; } - // Initialize m_iovec to point to the buffer and buffer size - // using the conventions of Berkeley style UIO structures, as required - // by PTRACE extensions. + // Initialize m_iovec to point to the buffer and buffer size using the + // conventions of Berkeley style UIO structures, as required by PTRACE + // extensions. m_iovec.iov_base = &m_msa; m_iovec.iov_len = sizeof(MSA_linux_mips); @@ -337,7 +337,8 @@ uint8_t byte_size = reg_info->byte_size; lldbassert(reg_info->byte_offset < sizeof(UserArea)); - // Initialise the FP and MSA buffers by reading all co-processor 1 registers + // Initialise the FP and MSA buffers by reading all co-processor 1 + // registers ReadCP1(); if (IsFPR(reg_index)) { Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_ppc64le.cpp @@ -26,8 +26,7 @@ #include "Plugins/Process/Utility/RegisterInfoPOSIX_ppc64le.h" // System includes - They have to be included after framework includes because -// they define some -// macros which collide with variable names in other modules +// they define some macros which collide with variable names in other modules #include #include #include @@ -569,8 +568,8 @@ lldb::addr_t real_addr = addr; uint32_t rw_mode = 0; - // Check if we are setting watchpoint other than read/write/access - // Update watchpoint flag to match ppc64le write-read bit configuration. + // Check if we are setting watchpoint other than read/write/access Update + // watchpoint flag to match ppc64le write-read bit configuration. switch (watch_flags) { case eWatchpointKindWrite: rw_mode = PPC_BREAKPOINT_TRIGGER_WRITE; @@ -591,9 +590,9 @@ if (size != 1 && size != 2 && size != 4 && size != 8) return LLDB_INVALID_INDEX32; - // Check 8-byte alignment for hardware watchpoint target address. - // Below is a hack to recalculate address and size in order to - // make sure we can watch non 8-byte alligned addresses as well. + // Check 8-byte alignment for hardware watchpoint target address. Below is a + // hack to recalculate address and size in order to make sure we can watch + // non 8-byte alligned addresses as well. if (addr & 0x07) { addr_t begin = llvm::alignDown(addr, 8); Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_s390x.cpp @@ -372,10 +372,10 @@ DoReadRegisterSet(NT_S390_SYSTEM_CALL, dst, 4); dst += 4; - // To enable inferior function calls while the process is stopped in - // an interrupted system call, we need to clear the system call flag. - // It will be restored to its original value by WriteAllRegisterValues. - // Again we ignore error if the regset is unsupported. + // To enable inferior function calls while the process is stopped in an + // interrupted system call, we need to clear the system call flag. It will be + // restored to its original value by WriteAllRegisterValues. Again we ignore + // error if the regset is unsupported. uint32_t system_call = 0; DoWriteRegisterSet(NT_S390_SYSTEM_CALL, &system_call, 4); Index: lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp @@ -329,9 +329,9 @@ break; } - // Initialize m_iovec to point to the buffer and buffer size - // using the conventions of Berkeley style UIO structures, as required - // by PTRACE extensions. + // Initialize m_iovec to point to the buffer and buffer size using the + // conventions of Berkeley style UIO structures, as required by PTRACE + // extensions. m_iovec.iov_base = &m_fpr; m_iovec.iov_len = sizeof(m_fpr); @@ -420,14 +420,14 @@ error = ReadRegisterRaw(full_reg, reg_value); if (error.Success()) { - // If our read was not aligned (for ah,bh,ch,dh), shift our returned value - // one byte to the right. + // If our read was not aligned (for ah,bh,ch,dh), shift our returned + // value one byte to the right. if (is_subreg && (reg_info->byte_offset & 0x1)) reg_value.SetUInt64(reg_value.GetAsUInt64() >> 8); // If our return byte size was greater than the return value reg size, - // then - // use the type specified by reg_info rather than the uint64_t default + // then use the type specified by reg_info rather than the uint64_t + // default if (reg_value.GetByteSize() > reg_info->byte_size) reg_value.SetType(reg_info); } @@ -448,7 +448,8 @@ reg_value.SetBytes(m_fpr.fxsave.xmm[reg - m_reg_info.first_xmm].bytes, reg_info->byte_size, byte_order); if (reg >= m_reg_info.first_ymm && reg <= m_reg_info.last_ymm) { - // Concatenate ymm using the register halves in xmm.bytes and ymmh.bytes + // Concatenate ymm using the register halves in xmm.bytes and + // ymmh.bytes if (CopyXSTATEtoYMM(reg, byte_order)) reg_value.SetBytes(m_ymm_set.ymm[reg - m_reg_info.first_ymm].bytes, reg_info->byte_size, byte_order); @@ -492,8 +493,7 @@ // Byte offsets of all registers are calculated wrt 'UserArea' structure. // However, ReadFPR() reads fpu registers {using ptrace(PTRACE_GETFPREGS,..)} // and stores them in 'm_fpr' (of type FPR structure). To extract values of - // fpu - // registers, m_fpr should be read at byte offsets calculated wrt to FPR + // fpu registers, m_fpr should be read at byte offsets calculated wrt to FPR // structure. // Since, FPR structure is also one of the member of UserArea structure. @@ -599,11 +599,10 @@ // Get pointer to m_fpr.fxsave variable and set the data to it. // Byte offsets of all registers are calculated wrt 'UserArea' structure. - // However, WriteFPR() takes m_fpr (of type FPR structure) and writes only - // fpu - // registers using ptrace(PTRACE_SETFPREGS,..) API. Hence fpu registers - // should - // be written in m_fpr at byte offsets calculated wrt FPR structure. + // However, WriteFPR() takes m_fpr (of type FPR structure) and writes + // only fpu registers using ptrace(PTRACE_SETFPREGS,..) API. Hence fpu + // registers should be written in m_fpr at byte offsets calculated wrt + // FPR structure. // Since, FPR structure is also one of the member of UserArea structure. // byte_offset(fpu wrt FPR) = byte_offset(fpu wrt UserArea) - @@ -1093,8 +1092,7 @@ if (error.Fail()) return error; - // for watchpoints 0, 1, 2, or 3, respectively, - // set bits 1, 3, 5, or 7 + // for watchpoints 0, 1, 2, or 3, respectively, set bits 1, 3, 5, or 7 uint64_t enable_bit = 1 << (2 * wp_index); // set bits 16-17, 20-21, 24-25, or 28-29 @@ -1132,8 +1130,8 @@ RegisterValue reg_value; - // for watchpoints 0, 1, 2, or 3, respectively, - // clear bits 0, 1, 2, or 3 of the debug status register (DR6) + // for watchpoints 0, 1, 2, or 3, respectively, clear bits 0, 1, 2, or 3 of + // the debug status register (DR6) Status error = ReadRegisterRaw(m_reg_info.first_dr + 6, reg_value); if (error.Fail()) return false; @@ -1143,9 +1141,9 @@ if (error.Fail()) return false; - // for watchpoints 0, 1, 2, or 3, respectively, - // clear bits {0-1,16-19}, {2-3,20-23}, {4-5,24-27}, or {6-7,28-31} - // of the debug control register (DR7) + // for watchpoints 0, 1, 2, or 3, respectively, clear bits {0-1,16-19}, + // {2-3,20-23}, {4-5,24-27}, or {6-7,28-31} of the debug control register + // (DR7) error = ReadRegisterRaw(m_reg_info.first_dr + 7, reg_value); if (error.Fail()) return false; Index: lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp +++ lldb/trunk/source/Plugins/Process/Linux/NativeThreadLinux.cpp @@ -211,8 +211,8 @@ m_stop_info.reason = StopReason::eStopReasonNone; m_stop_description.clear(); - // If watchpoints have been set, but none on this thread, - // then this is a new thread. So set all existing watchpoints. + // If watchpoints have been set, but none on this thread, then this is a new + // thread. So set all existing watchpoints. if (m_watchpoint_index_map.empty()) { NativeProcessLinux &process = GetProcess(); @@ -263,8 +263,8 @@ data = signo; // If hardware single-stepping is not supported, we just do a continue. The - // breakpoint on the - // next instruction has been setup in NativeProcessLinux::Resume. + // breakpoint on the next instruction has been setup in + // NativeProcessLinux::Resume. return NativeProcessLinux::PtraceWrapper( GetProcess().SupportHardwareSingleStepping() ? PTRACE_SINGLESTEP : PTRACE_CONT, Index: lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp +++ lldb/trunk/source/Plugins/Process/Linux/SingleStepCheck.cpp @@ -59,9 +59,9 @@ bool WorkaroundNeeded() { // We shall spawn a child, and use it to verify the debug capabilities of the - // cpu. We shall iterate through the cpus, bind the child to each one in turn, - // and verify that single-stepping works on that cpu. A workaround is needed - // if we find at least one broken cpu. + // cpu. We shall iterate through the cpus, bind the child to each one in + // turn, and verify that single-stepping works on that cpu. A workaround is + // needed if we find at least one broken cpu. Log *log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD); ::pid_t child_pid = fork(); Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp @@ -118,16 +118,14 @@ } } else if (reply_sequence_id > request_sequence_id) { // Sequence ID was greater than the sequence ID of the packet we - // sent, something - // is really wrong... + // sent, something is really wrong... reply_packet.Clear(); return false; } else { - // The reply sequence ID was less than our current packet's sequence - // ID - // so we should keep trying to get a response because this was a - // response - // for a previous packet that we must have retried. + // The reply sequence ID was less than our current packet's + // sequence ID so we should keep trying to get a response because + // this was a response for a previous packet that we must have + // retried. } } else { // Break and retry sending the packet as we didn't get a response due @@ -315,9 +313,9 @@ offset = 2; const uint16_t length = packet.GetU16(&offset); if (length <= bytes_available) { - // We have an entire packet ready, we need to copy the data - // bytes into a buffer that will be owned by the packet and - // erase the bytes from our communcation buffer "m_bytes" + // We have an entire packet ready, we need to copy the data bytes into + // a buffer that will be owned by the packet and erase the bytes from + // our communcation buffer "m_bytes" packet.SetData(DataBufferSP(new DataBufferHeap(&m_bytes[0], length))); m_bytes.erase(0, length); @@ -332,8 +330,8 @@ } break; default: - // Unrecognized reply command byte, erase this byte and try to get back on - // track + // Unrecognized reply command byte, erase this byte and try to get back + // on track if (log) log->Printf("CommunicationKDP::%s: tossing junk byte: 0x%2.2x", __FUNCTION__, (uint8_t)m_bytes[0]); @@ -1208,8 +1206,8 @@ if (src) { ::memcpy(dst, src, bytes_to_copy); error.Clear(); - // Return the number of bytes we could have returned regardless if - // we copied them or not, just so we know when things don't match up + // Return the number of bytes we could have returned regardless if we + // copied them or not, just so we know when things don't match up return src_len; } } Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -172,10 +172,10 @@ //---------------------------------------------------------------------- ProcessKDP::~ProcessKDP() { Clear(); - // We need to call finalize on the process before destroying ourselves - // to make sure all of the broadcaster cleanup goes as planned. If we - // destruct this class, then Process::~Process() might have problems - // trying to fully destroy the broadcaster. + // We need to call finalize on the process before destroying ourselves to + // make sure all of the broadcaster cleanup goes as planned. If we destruct + // this class, then Process::~Process() might have problems trying to fully + // destroy the broadcaster. Finalize(); } @@ -226,9 +226,9 @@ Status ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { Status error; - // Don't let any JIT happen when doing KDP as we can't allocate - // memory and we don't want to be mucking with threads that might - // already be handling exceptions + // Don't let any JIT happen when doing KDP as we can't allocate memory and we + // don't want to be mucking with threads that might already be handling + // exceptions SetCanJIT(false); if (remote_url.empty()) { @@ -282,16 +282,15 @@ if (m_comm.RemoteIsEFI()) { // Select an invalid plugin name for the dynamic loader so one - // doesn't get used - // since EFI does its own manual loading via python scripting + // doesn't get used since EFI does its own manual loading via + // python scripting static ConstString g_none_dynamic_loader("none"); m_dyld_plugin_name = g_none_dynamic_loader; if (kernel_uuid.IsValid()) { - // If EFI passed in a UUID= try to lookup UUID - // The slide will not be provided. But the UUID - // lookup will be used to launch EFI debug scripts - // from the dSYM, that can load all of the symbols. + // If EFI passed in a UUID= try to lookup UUID The slide will not + // be provided. But the UUID lookup will be used to launch EFI + // debug scripts from the dSYM, that can load all of the symbols. ModuleSpec module_spec; module_spec.GetUUID() = kernel_uuid; module_spec.GetArchitecture() = target.GetArchitecture(); @@ -443,8 +442,8 @@ StateAsCString(thread_resume_state)); switch (thread_resume_state) { case eStateSuspended: - // Nothing to do here when a thread will stay suspended - // we just leave the CPU mask bit set to zero for the thread + // Nothing to do here when a thread will stay suspended we just leave the + // CPU mask bit set to zero for the thread if (log) log->Printf("ProcessKDP::DoResume() = suspended???"); break; @@ -535,8 +534,8 @@ } void ProcessKDP::RefreshStateAfterStop() { - // Let all threads recover from stopping and do any clean up based - // on the previous thread state (if any). + // Let all threads recover from stopping and do any clean up based on the + // previous thread state (if any). m_thread_list.RefreshStateAfterStop(); } @@ -545,9 +544,9 @@ if (m_comm.IsRunning()) { if (m_destroy_in_process) { - // If we are attemping to destroy, we need to not return an error to - // Halt or DoDestroy won't get called. - // We are also currently running, so send a process stopped event + // If we are attemping to destroy, we need to not return an error to Halt + // or DoDestroy won't get called. We are also currently running, so send + // a process stopped event SetPrivateState(eStateStopped); } else { error.SetErrorString("KDP cannot interrupt a running kernel"); @@ -563,8 +562,8 @@ log->Printf("ProcessKDP::DoDetach(keep_stopped = %i)", keep_stopped); if (m_comm.IsRunning()) { - // We are running and we can't interrupt a running kernel, so we need - // to just close the connection to the kernel and hope for the best + // We are running and we can't interrupt a running kernel, so we need to + // just close the connection to the kernel and hope for the best } else { // If we are going to keep the target stopped, then don't send the // disconnect message. Index: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp @@ -65,8 +65,8 @@ // context by the time this function gets called. The KDPRegisterContext // class has been made smart enough to detect when it needs to invalidate // which registers are valid by putting hooks in the register read and - // register supply functions where they check the process stop ID and do - // the right thing. + // register supply functions where they check the process stop ID and do the + // right thing. const bool force = false; lldb::RegisterContextSP reg_ctx_sp(GetRegisterContext()); if (reg_ctx_sp) @@ -151,8 +151,8 @@ const uint32_t exc_type = exc_reply_packet.GetU32(&offset); const uint32_t exc_code = exc_reply_packet.GetU32(&offset); const uint32_t exc_subcode = exc_reply_packet.GetU32(&offset); - // We have to make a copy of the stop info because the thread list - // will iterate through the threads and clear all stop infos.. + // We have to make a copy of the stop info because the thread list will + // iterate through the threads and clear all stop infos.. // Let the StopInfoMachException::CreateStopReasonWithMachException() // function update the PC if needed as we might hit a software breakpoint Index: lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp +++ lldb/trunk/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -24,8 +24,7 @@ #include "llvm/Support/Errno.h" // System includes - They have to be included after framework includes because -// they define some -// macros which collide with variable names in other modules +// they define some macros which collide with variable names in other modules // clang-format off #include #include @@ -352,8 +351,8 @@ return error; } else LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size); - // First try probing for a breakpoint at a software breakpoint location: PC - // - breakpoint size. + // First try probing for a breakpoint at a software breakpoint location: PC - + // breakpoint size. const lldb::addr_t initial_pc_addr = context.GetPCfromBreakpointLocation(); lldb::addr_t breakpoint_addr = initial_pc_addr; @@ -562,8 +561,8 @@ "descending memory map entries detected, unexpected"); prev_base_address = proc_entry_info.GetRange().GetRangeBase(); UNUSED_IF_ASSERT_DISABLED(prev_base_address); - // If the target address comes before this entry, indicate distance to - // next region. + // If the target address comes before this entry, indicate distance to next + // region. if (load_addr < proc_entry_info.GetRange().GetRangeBase()) { range_info.GetRange().SetRangeBase(load_addr); range_info.GetRange().SetByteSize( @@ -582,9 +581,8 @@ // parsed. } // If we made it here, we didn't find an entry that contained the given - // address. Return the - // load_addr as start and the amount of bytes betwwen load address and the - // end of the memory as size. + // address. Return the load_addr as start and the amount of bytes betwwen + // load address and the end of the memory as size. range_info.GetRange().SetRangeBase(load_addr); range_info.GetRange().SetRangeEnd(LLDB_INVALID_ADDRESS); range_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo); @@ -644,8 +642,8 @@ free(vm); if (m_mem_region_cache.empty()) { - // No entries after attempting to read them. This shouldn't happen. - // Assume we don't support map entries. + // No entries after attempting to read them. This shouldn't happen. Assume + // we don't support map entries. LLDB_LOG(log, "failed to find any vmmap entries, assuming no support " "for memory region metadata retrieval"); m_supports_mem_region = LazyBool::eLazyBoolNo; @@ -781,8 +779,8 @@ return status; int wstatus; - // Need to use WALLSIG otherwise we receive an error with errno=ECHLD - // At this point we should have a thread stopped if waitpid succeeds. + // Need to use WALLSIG otherwise we receive an error with errno=ECHLD At this + // point we should have a thread stopped if waitpid succeeds. if ((wstatus = waitpid(m_pid, NULL, WALLSIG)) < 0) return Status(errno, eErrorTypePOSIX); Index: lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp +++ lldb/trunk/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp @@ -161,8 +161,8 @@ CreateRegisterInfoInterface(const ArchSpec &target_arch) { assert((HostInfo::GetArchitecture().GetAddressByteSize() == 8) && "Register setting path assumes this is a 64-bit host"); - // X86_64 hosts know how to work with 64-bit and 32-bit EXEs using the - // x86_64 register context. + // X86_64 hosts know how to work with 64-bit and 32-bit EXEs using the x86_64 + // register context. return new RegisterContextNetBSD_x86_64(target_arch); } @@ -805,8 +805,7 @@ if (error.Fail()) return error; - // for watchpoints 0, 1, 2, or 3, respectively, - // set bits 1, 3, 5, or 7 + // for watchpoints 0, 1, 2, or 3, respectively, set bits 1, 3, 5, or 7 uint64_t enable_bit = 1 << (2 * wp_index); // set bits 16-17, 20-21, 24-25, or 28-29 @@ -845,8 +844,8 @@ RegisterValue reg_value; - // for watchpoints 0, 1, 2, or 3, respectively, - // clear bits 0, 1, 2, or 3 of the debug status register (DR6) + // for watchpoints 0, 1, 2, or 3, respectively, clear bits 0, 1, 2, or 3 of + // the debug status register (DR6) const RegisterInfo *const reg_info_dr6 = GetRegisterInfoAtIndex(lldb_dr6_x86_64); Status error = ReadRegister(reg_info_dr6, reg_value); @@ -858,9 +857,9 @@ if (error.Fail()) return false; - // for watchpoints 0, 1, 2, or 3, respectively, - // clear bits {0-1,16-19}, {2-3,20-23}, {4-5,24-27}, or {6-7,28-31} - // of the debug control register (DR7) + // for watchpoints 0, 1, 2, or 3, respectively, clear bits {0-1,16-19}, + // {2-3,20-23}, {4-5,24-27}, or {6-7,28-31} of the debug control register + // (DR7) const RegisterInfo *const reg_info_dr7 = GetRegisterInfoAtIndex(lldb_dr7_x86_64); error = ReadRegister(reg_info_dr7, reg_value); Index: lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp +++ lldb/trunk/source/Plugins/Process/POSIX/CrashReason.cpp @@ -47,8 +47,7 @@ #ifdef SI_KERNEL case SI_KERNEL: // Some platforms will occasionally send nonstandard spurious SI_KERNEL - // codes. - // One way to get this is via unaligned SIMD loads. + // codes. One way to get this is via unaligned SIMD loads. return CrashReason::eInvalidAddress; // for lack of anything better #endif case SEGV_MAPERR: Index: lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp +++ lldb/trunk/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp @@ -74,8 +74,8 @@ return 0; } - // { 'name':'rcx' , 'bitsize' : 64, 'offset' : 16, 'encoding':'uint' - // , 'format':'hex' , 'set': 0, 'ehframe' : 2, + // { 'name':'rcx' , 'bitsize' : 64, 'offset' : 16, + // 'encoding':'uint' , 'format':'hex' , 'set': 0, 'ehframe' : 2, // 'dwarf' : 2, 'generic':'arg4', 'alt-name':'arg4', }, RegisterInfo reg_info; std::vector value_regs; @@ -100,14 +100,11 @@ const ByteOrder byte_order = arch.GetByteOrder(); if (reg_info.byte_offset == UINT32_MAX) { - // No offset for this register, see if the register has a value expression - // which indicates this register is part of another register. Value - // expressions - // are things like "rax[31:0]" which state that the current register's - // value - // is in a concrete register "rax" in bits 31:0. If there is a value - // expression - // we can calculate the offset + // No offset for this register, see if the register has a value + // expression which indicates this register is part of another register. + // Value expressions are things like "rax[31:0]" which state that the + // current register's value is in a concrete register "rax" in bits 31:0. + // If there is a value expression we can calculate the offset bool success = false; llvm::StringRef slice_str; if (reg_info_dict->GetValueForKeyAsString("slice", slice_str, nullptr)) { @@ -491,8 +488,7 @@ } // sort and unique all invalidate registers and make sure each is terminated - // with - // LLDB_INVALID_REGNUM + // with LLDB_INVALID_REGNUM for (reg_to_regs_map::iterator pos = m_invalidate_regs_map.begin(), end = m_invalidate_regs_map.end(); pos != end; ++pos) { @@ -516,8 +512,8 @@ m_regs[i].invalidate_regs = NULL; } - // Check if we need to automatically set the generic registers in case - // they weren't set + // Check if we need to automatically set the generic registers in case they + // weren't set bool generic_regs_specified = false; for (const auto ® : m_regs) { if (reg.kinds[eRegisterKindGeneric] != LLDB_INVALID_REGNUM) { @@ -732,8 +728,8 @@ lldb_private::RegisterInfo *DynamicRegisterInfo::GetRegisterInfo( const lldb_private::ConstString ®_name) { for (auto ®_info : m_regs) { - // We can use pointer comparison since we used a ConstString to set - // the "name" member in AddRegister() + // We can use pointer comparison since we used a ConstString to set the + // "name" member in AddRegister() if (reg_info.name == reg_name.GetCString()) { return ®_info; } Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp @@ -968,9 +968,9 @@ const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); //---------------------------------------------------------------------- -// Register set definitions. The first definitions at register set index -// of zero is for all registers, followed by other registers sets. The -// register information for the all register set need not be filled in. +// Register set definitions. The first definitions at register set index of +// zero is for all registers, followed by other registers sets. The register +// information for the all register set need not be filled in. //---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp @@ -149,9 +149,9 @@ const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); //---------------------------------------------------------------------- -// Register set definitions. The first definitions at register set index -// of zero is for all registers, followed by other registers sets. The -// register information for the all register set need not be filled in. +// Register set definitions. The first definitions at register set index of +// zero is for all registers, followed by other registers sets. The register +// information for the all register set need not be filled in. //---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp @@ -147,9 +147,9 @@ sizeof(RegisterContextDarwin_i386::FPU)) // These macros will auto define the register name, alt name, register size, -// register offset, encoding, format and native register. This ensures that -// the register state structures are defined correctly and have the correct -// sizes and offsets. +// register offset, encoding, format and native register. This ensures that the +// register state structures are defined correctly and have the correct sizes +// and offsets. #define DEFINE_GPR(reg, alt) \ #reg, alt, sizeof(((RegisterContextDarwin_i386::GPR *) NULL)->reg), \ GPR_OFFSET(reg), eEncodingUint, eFormatHex @@ -464,9 +464,9 @@ const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); //---------------------------------------------------------------------- -// Register set definitions. The first definitions at register set index -// of zero is for all registers, followed by other registers sets. The -// register information for the all register set need not be filled in. +// Register set definitions. The first definitions at register set index of +// zero is for all registers, followed by other registers sets. The register +// information for the all register set need not be filled in. //---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { @@ -680,8 +680,7 @@ case fpu_stmm6: case fpu_stmm7: // These values don't fit into scalar types, - // RegisterContext::ReadRegisterBytes() must be used for these - // registers + // RegisterContext::ReadRegisterBytes() must be used for these registers //::memcpy (reg_value.value.vector.uint8, fpu.stmm[reg - fpu_stmm0].bytes, //10); return false; @@ -695,8 +694,7 @@ case fpu_xmm6: case fpu_xmm7: // These values don't fit into scalar types, - // RegisterContext::ReadRegisterBytes() - // must be used for these registers + // RegisterContext::ReadRegisterBytes() must be used for these registers //::memcpy (reg_value.value.vector.uint8, fpu.xmm[reg - fpu_xmm0].bytes, //16); return false; @@ -799,8 +797,7 @@ case fpu_stmm6: case fpu_stmm7: // These values don't fit into scalar types, - // RegisterContext::ReadRegisterBytes() - // must be used for these registers + // RegisterContext::ReadRegisterBytes() must be used for these registers ::memcpy(fpu.stmm[reg - fpu_stmm0].bytes, value.GetBytes(), value.GetByteSize()); return false; @@ -814,8 +811,7 @@ case fpu_xmm6: case fpu_xmm7: // These values don't fit into scalar types, - // RegisterContext::ReadRegisterBytes() - // must be used for these registers + // RegisterContext::ReadRegisterBytes() must be used for these registers ::memcpy(fpu.xmm[reg - fpu_xmm0].bytes, value.GetBytes(), value.GetByteSize()); return false; Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp @@ -165,9 +165,9 @@ sizeof(RegisterContextDarwin_x86_64::FPU)) // These macros will auto define the register name, alt name, register size, -// register offset, encoding, format and native register. This ensures that -// the register state structures are defined correctly and have the correct -// sizes and offsets. +// register offset, encoding, format and native register. This ensures that the +// register state structures are defined correctly and have the correct sizes +// and offsets. #define DEFINE_GPR(reg, alt) \ #reg, alt, sizeof(((RegisterContextDarwin_x86_64::GPR *) NULL)->reg), \ GPR_OFFSET(reg), eEncodingUint, eFormatHex @@ -525,9 +525,9 @@ const size_t k_num_exc_registers = llvm::array_lengthof(g_exc_regnums); //---------------------------------------------------------------------- -// Register set definitions. The first definitions at register set index -// of zero is for all registers, followed by other registers sets. The -// register information for the all register set need not be filled in. +// Register set definitions. The first definitions at register set index of +// zero is for all registers, followed by other registers sets. The register +// information for the all register set need not be filled in. //---------------------------------------------------------------------- static const RegisterSet g_reg_sets[] = { { Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -104,8 +104,7 @@ } // Initialize a RegisterContextLLDB which is the first frame of a stack -- the -// zeroth frame or currently -// executing frame. +// zeroth frame or currently executing frame. void RegisterContextLLDB::InitializeZerothFrame() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); @@ -131,25 +130,26 @@ // Let ABIs fixup code addresses to make sure they are valid. In ARM ABIs // this will strip bit zero in case we read a PC from memory or from the LR. // (which would be a no-op in frame 0 where we get it from the register set, - // but still a good idea to make the call here for other ABIs that may exist.) + // but still a good idea to make the call here for other ABIs that may + // exist.) ABI *abi = process->GetABI().get(); if (abi) current_pc = abi->FixCodeAddress(current_pc); - // Initialize m_current_pc, an Address object, based on current_pc, an addr_t. + // Initialize m_current_pc, an Address object, based on current_pc, an + // addr_t. m_current_pc.SetLoadAddress(current_pc, &process->GetTarget()); // If we don't have a Module for some reason, we're not going to find - // symbol/function information - just - // stick in some reasonable defaults and hope we can unwind past this frame. + // symbol/function information - just stick in some reasonable defaults and + // hope we can unwind past this frame. ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp) { UnwindLogMsg("using architectural default unwind method"); } // We require either a symbol or function in the symbols context to be - // successfully - // filled in or this context is of no use to us. + // successfully filled in or this context is of no use to us. const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol; if (pc_module_sp.get() && (pc_module_sp->ResolveSymbolContextForAddress( m_current_pc, resolve_scope, m_sym_ctx) & @@ -180,18 +180,17 @@ } // If we were able to find a symbol/function, set addr_range to the bounds of - // that symbol/function. - // else treat the current pc value as the start_pc and record no offset. + // that symbol/function. else treat the current pc value as the start_pc and + // record no offset. if (addr_range.GetBaseAddress().IsValid()) { m_start_pc = addr_range.GetBaseAddress(); if (m_current_pc.GetSection() == m_start_pc.GetSection()) { m_current_offset = m_current_pc.GetOffset() - m_start_pc.GetOffset(); } else if (m_current_pc.GetModule() == m_start_pc.GetModule()) { - // This means that whatever symbol we kicked up isn't really correct - // --- we should not cross section boundaries ... We really should NULL - // out - // the function/symbol in this case unless there is a bad assumption - // here due to inlined functions? + // This means that whatever symbol we kicked up isn't really correct --- + // we should not cross section boundaries ... We really should NULL out + // the function/symbol in this case unless there is a bad assumption here + // due to inlined functions? m_current_offset = m_current_pc.GetFileAddress() - m_start_pc.GetFileAddress(); } @@ -266,8 +265,7 @@ } // Initialize a RegisterContextLLDB for the non-zeroth frame -- rely on the -// RegisterContextLLDB "below" it -// to provide things like its current pc value. +// RegisterContextLLDB "below" it to provide things like its current pc value. void RegisterContextLLDB::InitializeNonZerothFrame() { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_UNWIND)); @@ -333,8 +331,8 @@ m_current_pc.SetLoadAddress(pc, &process->GetTarget(), allow_section_end); // If we don't have a Module for some reason, we're not going to find - // symbol/function information - just - // stick in some reasonable defaults and hope we can unwind past this frame. + // symbol/function information - just stick in some reasonable defaults and + // hope we can unwind past this frame. ModuleSP pc_module_sp(m_current_pc.GetModule()); if (!m_current_pc.IsValid() || !pc_module_sp) { UnwindLogMsg("using architectural default unwind method"); @@ -345,12 +343,10 @@ if (process->GetLoadAddressPermissions(pc, permissions) && (permissions & ePermissionsExecutable) == 0) { // If this is the second frame off the stack, we may have unwound the - // first frame - // incorrectly. But using the architecture default unwind plan may get us - // back on - // track -- albeit possibly skipping a real frame. Give this frame a - // clearly-invalid - // pc and see if we can get any further. + // first frame incorrectly. But using the architecture default unwind + // plan may get us back on track -- albeit possibly skipping a real + // frame. Give this frame a clearly-invalid pc and see if we can get any + // further. if (GetNextFrame().get() && GetNextFrame()->IsValid() && GetNextFrame()->IsFrameZero()) { UnwindLogMsg("had a pc of 0x%" PRIx64 " which is not in executable " @@ -359,8 +355,8 @@ (uint64_t)pc); m_frame_type = eSkipFrame; } else { - // anywhere other than the second frame, a non-executable pc means we're - // off in the weeds -- stop now. + // anywhere other than the second frame, a non-executable pc means + // we're off in the weeds -- stop now. m_frame_type = eNotAValidFrame; UnwindLogMsg("pc is in a non-executable section of memory and this " "isn't the 2nd frame in the stack walk."); @@ -399,8 +395,7 @@ } // m_cfa should point into the stack memory; if we can query memory - // region permissions, - // see if the memory is allocated & readable. + // region permissions, see if the memory is allocated & readable. if (process->GetLoadAddressPermissions(m_cfa, permissions) && (permissions & ePermissionsReadable) == 0) { m_frame_type = eNotAValidFrame; @@ -435,19 +430,18 @@ bool resolve_tail_call_address = false; // m_current_pc can be one past the // address range of the function... - // If the saved pc does not point to a function/symbol because it is - // beyond the bounds of the correct function and there's no symbol there, - // we do *not* want ResolveSymbolContextForAddress to back up the pc by 1, - // because then we might not find the correct unwind information later. - // Instead, let ResolveSymbolContextForAddress fail, and handle the case - // via decr_pc_and_recompute_addr_range below. + // If the saved pc does not point to a function/symbol because it is beyond + // the bounds of the correct function and there's no symbol there, we do + // *not* want ResolveSymbolContextForAddress to back up the pc by 1, because + // then we might not find the correct unwind information later. Instead, let + // ResolveSymbolContextForAddress fail, and handle the case via + // decr_pc_and_recompute_addr_range below. const uint32_t resolve_scope = eSymbolContextFunction | eSymbolContextSymbol; uint32_t resolved_scope = pc_module_sp->ResolveSymbolContextForAddress( m_current_pc, resolve_scope, m_sym_ctx, resolve_tail_call_address); // We require either a symbol or function in the symbols context to be - // successfully - // filled in or this context is of no use to us. + // successfully filled in or this context is of no use to us. if (resolve_scope & resolved_scope) { m_sym_ctx_valid = true; } @@ -476,8 +470,7 @@ decr_pc_and_recompute_addr_range = true; // Or if we're in the middle of the stack (and not "above" an asynchronous - // event like sigtramp), - // and our "current" pc is the start of a function... + // event like sigtramp), and our "current" pc is the start of a function... if (GetNextFrame()->m_frame_type != eTrapHandlerFrame && GetNextFrame()->m_frame_type != eDebuggerFrame && (!m_sym_ctx_valid || @@ -488,9 +481,8 @@ } // We need to back up the pc by 1 byte and re-search for the Symbol to handle - // the case where the "saved pc" - // value is pointing to the next function, e.g. if a function ends with a CALL - // instruction. + // the case where the "saved pc" value is pointing to the next function, e.g. + // if a function ends with a CALL instruction. // FIXME this may need to be an architectural-dependent behavior; if so we'll // need to add a member function // to the ABI plugin and consult that. @@ -516,9 +508,9 @@ GetSymbolOrFunctionName(m_sym_ctx).AsCString("")); } - // If we were able to find a symbol/function, set addr_range_ptr to the bounds - // of that symbol/function. - // else treat the current pc value as the start_pc and record no offset. + // If we were able to find a symbol/function, set addr_range_ptr to the + // bounds of that symbol/function. else treat the current pc value as the + // start_pc and record no offset. if (addr_range.GetBaseAddress().IsValid()) { m_start_pc = addr_range.GetBaseAddress(); m_current_offset = pc - m_start_pc.GetLoadAddress(&process->GetTarget()); @@ -553,9 +545,8 @@ RegisterKind row_register_kind = eRegisterKindGeneric; // Try to get by with just the fast UnwindPlan if possible - the full - // UnwindPlan may be expensive to get - // (e.g. if we have to parse the entire eh_frame section of an ObjectFile for - // the first time.) + // UnwindPlan may be expensive to get (e.g. if we have to parse the entire + // eh_frame section of an ObjectFile for the first time.) if (m_fast_unwind_plan_sp && m_fast_unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { @@ -616,16 +607,14 @@ bool RegisterContextLLDB::CheckIfLoopingStack() { // If we have a bad stack setup, we can get the same CFA value multiple times - // -- or even - // more devious, we can actually oscillate between two CFA values. Detect that - // here and - // break out to avoid a possible infinite loop in lldb trying to unwind the - // stack. - // To detect when we have the same CFA value multiple times, we compare the + // -- or even more devious, we can actually oscillate between two CFA values. + // Detect that here and break out to avoid a possible infinite loop in lldb + // trying to unwind the stack. To detect when we have the same CFA value + // multiple times, we compare the // CFA of the current // frame with the 2nd next frame because in some specail case (e.g. signal - // hanlders, hand - // written assembly without ABI compiance) we can have 2 frames with the same + // hanlders, hand written assembly without ABI compiance) we can have 2 + // frames with the same // CFA (in theory we // can have arbitrary number of frames with the same CFA, but more then 2 is // very very unlikely) @@ -734,15 +723,12 @@ } // If we've done a jmp 0x0 / bl 0x0 (called through a null function pointer) - // so the pc is 0x0 - // in the zeroth frame, we need to use the "unwind at first instruction" arch - // default UnwindPlan - // Also, if this Process can report on memory region attributes, any - // non-executable region means - // we jumped through a bad function pointer - handle the same way as 0x0. - // Note, if we have a symbol context & a symbol, we don't want to follow this - // code path. This is - // for jumping to memory regions without any information available. + // so the pc is 0x0 in the zeroth frame, we need to use the "unwind at first + // instruction" arch default UnwindPlan Also, if this Process can report on + // memory region attributes, any non-executable region means we jumped + // through a bad function pointer - handle the same way as 0x0. Note, if we + // have a symbol context & a symbol, we don't want to follow this code path. + // This is for jumping to memory regions without any information available. if ((!m_sym_ctx_valid || (m_sym_ctx.function == NULL && m_sym_ctx.symbol == NULL)) && @@ -780,12 +766,10 @@ } // No FuncUnwinders available for this pc (stripped function symbols, lldb - // could not augment its - // function table with another source, like LC_FUNCTION_STARTS or eh_frame in - // ObjectFileMachO). - // See if eh_frame or the .ARM.exidx tables have unwind information for this - // address, else fall - // back to the architectural default unwind. + // could not augment its function table with another source, like + // LC_FUNCTION_STARTS or eh_frame in ObjectFileMachO). See if eh_frame or the + // .ARM.exidx tables have unwind information for this address, else fall back + // to the architectural default unwind. if (!func_unwinders_sp) { m_frame_type = eNormalFrame; @@ -793,7 +777,8 @@ !m_current_pc.IsValid()) return arch_default_unwind_plan_sp; - // Even with -fomit-frame-pointer, we can try eh_frame to get back on track. + // Even with -fomit-frame-pointer, we can try eh_frame to get back on + // track. DWARFCallFrameInfo *eh_frame = pc_module_sp->GetObjectFile()->GetUnwindTable().GetEHFrameInfo(); if (eh_frame) { @@ -819,11 +804,10 @@ } // If we're in _sigtramp(), unwinding past this frame requires special - // knowledge. On Mac OS X this knowledge - // is properly encoded in the eh_frame section, so prefer that if available. - // On other platforms we may need to provide a platform-specific UnwindPlan - // which encodes the details of - // how to unwind out of sigtramp. + // knowledge. On Mac OS X this knowledge is properly encoded in the eh_frame + // section, so prefer that if available. On other platforms we may need to + // provide a platform-specific UnwindPlan which encodes the details of how to + // unwind out of sigtramp. if (m_frame_type == eTrapHandlerFrame && process) { m_fast_unwind_plan_sp.reset(); unwind_plan_sp = func_unwinders_sp->GetEHFrameUnwindPlan( @@ -835,24 +819,19 @@ } // Ask the DynamicLoader if the eh_frame CFI should be trusted in this frame - // even when it's frame zero - // This comes up if we have hand-written functions in a Module and - // hand-written eh_frame. The assembly - // instruction inspection may fail and the eh_frame CFI were probably written - // with some care to do the - // right thing. It'd be nice if there was a way to ask the eh_frame directly - // if it is asynchronous - // (can be trusted at every instruction point) or synchronous (the normal case - // - only at call sites). + // even when it's frame zero This comes up if we have hand-written functions + // in a Module and hand-written eh_frame. The assembly instruction + // inspection may fail and the eh_frame CFI were probably written with some + // care to do the right thing. It'd be nice if there was a way to ask the + // eh_frame directly if it is asynchronous (can be trusted at every + // instruction point) or synchronous (the normal case - only at call sites). // But there is not. if (process && process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo(m_sym_ctx)) { // We must specifically call the GetEHFrameUnwindPlan() method here -- - // normally we would - // call GetUnwindPlanAtCallSite() -- because CallSite may return an unwind - // plan sourced from - // either eh_frame (that's what we intend) or compact unwind (this won't - // work) + // normally we would call GetUnwindPlanAtCallSite() -- because CallSite may + // return an unwind plan sourced from either eh_frame (that's what we + // intend) or compact unwind (this won't work) unwind_plan_sp = func_unwinders_sp->GetEHFrameUnwindPlan( process->GetTarget(), m_current_offset_backed_up_one); if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { @@ -871,22 +850,16 @@ if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress(m_current_pc)) { if (unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolNo) { // We probably have an UnwindPlan created by inspecting assembly - // instructions. The - // assembly profilers work really well with compiler-generated functions - // but hand- - // written assembly can be problematic. We set the eh_frame based unwind - // plan as our - // fallback unwind plan if instruction emulation doesn't work out even - // for non call - // sites if it is available and use the architecture default unwind plan - // if it is + // instructions. The assembly profilers work really well with compiler- + // generated functions but hand- written assembly can be problematic. + // We set the eh_frame based unwind plan as our fallback unwind plan if + // instruction emulation doesn't work out even for non call sites if it + // is available and use the architecture default unwind plan if it is // not available. The eh_frame unwind plan is more reliable even on non - // call sites - // then the architecture default plan and for hand written assembly code - // it is often - // written in a way that it valid at all location what helps in the most - // common - // cases when the instruction emulation fails. + // call sites then the architecture default plan and for hand written + // assembly code it is often written in a way that it valid at all + // location what helps in the most common cases when the instruction + // emulation fails. UnwindPlanSP call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite( process->GetTarget(), m_current_offset_backed_up_one); @@ -919,9 +892,8 @@ } // We'd prefer to use an UnwindPlan intended for call sites when we're at a - // call site but if we've - // struck out on that, fall back to using the non-call-site assembly - // inspection UnwindPlan if possible. + // call site but if we've struck out on that, fall back to using the non- + // call-site assembly inspection UnwindPlan if possible. if (process) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtNonCallSite( process->GetTarget(), m_thread, m_current_offset_backed_up_one); @@ -929,19 +901,14 @@ if (unwind_plan_sp && unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolNo) { // We probably have an UnwindPlan created by inspecting assembly - // instructions. The assembly - // profilers work really well with compiler-generated functions but hand- - // written assembly - // can be problematic. We set the eh_frame based unwind plan as our fallback - // unwind plan if + // instructions. The assembly profilers work really well with compiler- + // generated functions but hand- written assembly can be problematic. We + // set the eh_frame based unwind plan as our fallback unwind plan if // instruction emulation doesn't work out even for non call sites if it is - // available and use - // the architecture default unwind plan if it is not available. The eh_frame - // unwind plan is - // more reliable even on non call sites then the architecture default plan - // and for hand - // written assembly code it is often written in a way that it valid at all - // location what + // available and use the architecture default unwind plan if it is not + // available. The eh_frame unwind plan is more reliable even on non call + // sites then the architecture default plan and for hand written assembly + // code it is often written in a way that it valid at all location what // helps in the most common cases when the instruction emulation fails. UnwindPlanSP call_site_unwind_plan = func_unwinders_sp->GetUnwindPlanAtCallSite( @@ -963,8 +930,8 @@ } // If we're on the first instruction of a function, and we have an - // architectural default UnwindPlan - // for the initial instruction of a function, use that. + // architectural default UnwindPlan for the initial instruction of a + // function, use that. if (m_current_offset_backed_up_one == 0) { unwind_plan_sp = func_unwinders_sp->GetUnwindPlanArchitectureDefaultAtFunctionEntry( @@ -1115,12 +1082,10 @@ } // After the final stack frame in a stack walk we'll get one invalid -// (eNotAValidFrame) stack frame -- -// one past the end of the stack walk. But higher-level code will need to tell -// the differnece between -// "the unwind plan below this frame failed" versus "we successfully completed -// the stack walk" so -// this method helps to disambiguate that. +// (eNotAValidFrame) stack frame -- one past the end of the stack walk. But +// higher-level code will need to tell the differnece between "the unwind plan +// below this frame failed" versus "we successfully completed the stack walk" +// so this method helps to disambiguate that. bool RegisterContextLLDB::IsTrapHandlerFrame() const { return m_frame_type == eTrapHandlerFrame; @@ -1129,12 +1094,10 @@ // A skip frame is a bogus frame on the stack -- but one where we're likely to // find a real frame farther // up the stack if we keep looking. It's always the second frame in an unwind -// (i.e. the first frame after -// frame zero) where unwinding can be the trickiest. Ideally we'll mark up this -// frame in some way so the -// user knows we're displaying bad data and we may have skipped one frame of -// their real program in the -// process of getting back on track. +// (i.e. the first frame after frame zero) where unwinding can be the +// trickiest. Ideally we'll mark up this frame in some way so the user knows +// we're displaying bad data and we may have skipped one frame of their real +// program in the process of getting back on track. bool RegisterContextLLDB::IsSkipFrame() const { return m_frame_type == eSkipFrame; @@ -1231,8 +1194,8 @@ RegisterNumber return_address_reg; // If we're fetching the saved pc and this UnwindPlan defines a - // ReturnAddress register (e.g. lr on arm), - // look for the return address register number in the UnwindPlan's row. + // ReturnAddress register (e.g. lr on arm), look for the return address + // register number in the UnwindPlan's row. if (pc_regnum.IsValid() && pc_regnum == regnum && m_full_unwind_plan_sp->GetReturnAddressRegister() != LLDB_INVALID_REGNUM) { @@ -1272,10 +1235,8 @@ } // This is frame 0 and we're retrieving the PC and it's saved in a Return - // Address register and - // it hasn't been saved anywhere yet -- that is, it's still live in the - // actual register. - // Handle this specially. + // Address register and it hasn't been saved anywhere yet -- that is, + // it's still live in the actual register. Handle this specially. if (have_unwindplan_regloc == false && return_address_reg.IsValid() && IsFrameZero()) { @@ -1298,22 +1259,18 @@ } // If this architecture stores the return address in a register (it - // defines a Return Address register) - // and we're on a non-zero stack frame and the Full UnwindPlan says that - // the pc is stored in the + // defines a Return Address register) and we're on a non-zero stack frame + // and the Full UnwindPlan says that the pc is stored in the // RA registers (e.g. lr on arm), then we know that the full unwindplan is // not trustworthy -- this // is an impossible situation and the instruction emulation code has - // likely been misled. - // If this stack frame meets those criteria, we need to throw away the - // Full UnwindPlan that the - // instruction emulation came up with and fall back to the architecture's - // Default UnwindPlan so - // the stack walk can get past this point. + // likely been misled. If this stack frame meets those criteria, we need + // to throw away the Full UnwindPlan that the instruction emulation came + // up with and fall back to the architecture's Default UnwindPlan so the + // stack walk can get past this point. // Special note: If the Full UnwindPlan was generated from the compiler, - // don't second-guess it - // when we're at a call site location. + // don't second-guess it when we're at a call site location. // arch_default_ra_regnum is the return address register # in the Full // UnwindPlan register numbering @@ -1376,11 +1333,10 @@ ExecutionContext exe_ctx(m_thread.shared_from_this()); Process *process = exe_ctx.GetProcessPtr(); if (have_unwindplan_regloc == false) { - // If the UnwindPlan failed to give us an unwind location for this register, - // we may be able to fall back - // to some ABI-defined default. For example, some ABIs allow to determine - // the caller's SP via the CFA. - // Also, the ABI may set volatile registers to the undefined state. + // If the UnwindPlan failed to give us an unwind location for this + // register, we may be able to fall back to some ABI-defined default. For + // example, some ABIs allow to determine the caller's SP via the CFA. Also, + // the ABI may set volatile registers to the undefined state. ABI *abi = process ? process->GetABI().get() : NULL; if (abi) { const RegisterInfo *reg_info = @@ -1558,24 +1514,19 @@ // TryFallbackUnwindPlan() -- this method is a little tricky. // // When this is called, the frame above -- the caller frame, the "previous" -// frame -- -// is invalid or bad. +// frame -- is invalid or bad. // -// Instead of stopping the stack walk here, we'll try a different UnwindPlan and -// see -// if we can get a valid frame above us. +// Instead of stopping the stack walk here, we'll try a different UnwindPlan +// and see if we can get a valid frame above us. // // This most often happens when an unwind plan based on assembly instruction -// inspection -// is not correct -- mostly with hand-written assembly functions or functions -// where the -// stack frame is set up "out of band", e.g. the kernel saved the register -// context and -// then called an asynchronous trap handler like _sigtramp. +// inspection is not correct -- mostly with hand-written assembly functions or +// functions where the stack frame is set up "out of band", e.g. the kernel +// saved the register context and then called an asynchronous trap handler like +// _sigtramp. // // Often in these cases, if we just do a dumb stack walk we'll get past this -// tricky -// frame and our usual techniques can continue to be used. +// tricky frame and our usual techniques can continue to be used. bool RegisterContextLLDB::TryFallbackUnwindPlan() { if (m_fallback_unwind_plan_sp.get() == nullptr) @@ -1591,15 +1542,13 @@ } // If a compiler generated unwind plan failed, trying the arch default - // unwindplan - // isn't going to do any better. + // unwindplan isn't going to do any better. if (m_full_unwind_plan_sp->GetSourcedFromCompiler() == eLazyBoolYes) return false; - // Get the caller's pc value and our own CFA value. - // Swap in the fallback unwind plan, re-fetch the caller's pc value and CFA - // value. - // If they're the same, then the fallback unwind plan provides no benefit. + // Get the caller's pc value and our own CFA value. Swap in the fallback + // unwind plan, re-fetch the caller's pc value and CFA value. If they're the + // same, then the fallback unwind plan provides no benefit. RegisterNumber pc_regnum(m_thread, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC); @@ -1622,23 +1571,18 @@ } // This is a tricky wrinkle! If SavedLocationForRegister() detects a really - // impossible - // register location for the full unwind plan, it may call - // ForceSwitchToFallbackUnwindPlan() - // which in turn replaces the full unwindplan with the fallback... in short, - // we're done, - // we're using the fallback UnwindPlan. - // We checked if m_fallback_unwind_plan_sp was nullptr at the top -- the only - // way it - // became nullptr since then is via SavedLocationForRegister(). + // impossible register location for the full unwind plan, it may call + // ForceSwitchToFallbackUnwindPlan() which in turn replaces the full + // unwindplan with the fallback... in short, we're done, we're using the + // fallback UnwindPlan. We checked if m_fallback_unwind_plan_sp was nullptr + // at the top -- the only way it became nullptr since then is via + // SavedLocationForRegister(). if (m_fallback_unwind_plan_sp.get() == nullptr) return true; // Switch the full UnwindPlan to be the fallback UnwindPlan. If we decide - // this isn't - // working, we need to restore. - // We'll also need to save & restore the value of the m_cfa ivar. Save is - // down below a bit in 'old_cfa'. + // this isn't working, we need to restore. We'll also need to save & restore + // the value of the m_cfa ivar. Save is down below a bit in 'old_cfa'. UnwindPlanSP original_full_unwind_plan_sp = m_full_unwind_plan_sp; addr_t old_cfa = m_cfa; @@ -2049,10 +1993,9 @@ // A pc value of 0 or 1 is impossible in the middle of the stack -- it // indicates the end of a stack walk. // On the currently executing frame (or such a frame interrupted - // asynchronously by sigtramp et al) this may - // occur if code has jumped through a NULL pointer -- we want to be able to - // unwind past that frame to help - // find the bug. + // asynchronously by sigtramp et al) this may occur if code has jumped + // through a NULL pointer -- we want to be able to unwind past that frame + // to help find the bug. ProcessSP process_sp (m_thread.GetProcess()); if (process_sp) Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp @@ -139,8 +139,8 @@ bool RegisterContextMacOSXFrameBackchain::WriteRegister( const RegisterInfo *reg_info, const RegisterValue &value) { - // Not supported yet. We could easily add support for this by remembering - // the address of each entry (it would need to be part of the cursor) + // Not supported yet. We could easily add support for this by remembering the + // address of each entry (it would need to be part of the cursor) return false; } @@ -154,10 +154,10 @@ bool RegisterContextMacOSXFrameBackchain::WriteAllRegisterValues( const lldb::DataBufferSP &data_sp) { - // Since this class doesn't respond to "ReadAllRegisterValues()", it must - // not have been the one that saved all the register values. So we just let - // the thread's register context (the register context for frame zero) do - // the writing. + // Since this class doesn't respond to "ReadAllRegisterValues()", it must not + // have been the one that saved all the register values. So we just let the + // thread's register context (the register context for frame zero) do the + // writing. return m_thread.GetRegisterContext()->WriteAllRegisterValues(data_sp); } Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMemory.cpp @@ -32,9 +32,9 @@ addr_t reg_data_addr) : RegisterContext(thread, concrete_frame_idx), m_reg_infos(reg_infos), m_reg_valid(), m_reg_data(), m_reg_data_addr(reg_data_addr) { - // Resize our vector of bools to contain one bool for every register. - // We will use these boolean values to know when a register value - // is valid in m_reg_data. + // Resize our vector of bools to contain one bool for every register. We will + // use these boolean values to know when a register value is valid in + // m_reg_data. const size_t num_regs = reg_infos.GetNumRegisters(); assert(num_regs > 0); m_reg_valid.resize(num_regs); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm.cpp @@ -142,8 +142,8 @@ const lldb_private::RegisterInfo *RegisterContextPOSIX_arm::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -199,8 +199,8 @@ return set_index < k_num_register_sets; } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_arm::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp @@ -162,8 +162,8 @@ const lldb_private::RegisterInfo * RegisterContextPOSIX_arm64::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -219,8 +219,8 @@ return set_index < k_num_register_sets; } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_arm64::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_mips64.cpp @@ -92,8 +92,8 @@ const RegisterInfo *RegisterContextPOSIX_mips64::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -172,8 +172,8 @@ return (set_index < num_sets); } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_mips64::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = m_num_registers; Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_powerpc.cpp @@ -129,8 +129,8 @@ const RegisterInfo *RegisterContextPOSIX_powerpc::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -181,8 +181,8 @@ return (set_index < num_sets); } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_powerpc::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_ppc64le.cpp @@ -146,8 +146,8 @@ const RegisterInfo *RegisterContextPOSIX_ppc64le::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -198,8 +198,8 @@ return (set_index < num_sets); } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_ppc64le::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_s390x.cpp @@ -174,8 +174,8 @@ return byte_order; } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_s390x::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp @@ -414,8 +414,8 @@ const RegisterInfo *RegisterContextPOSIX_x86::GetRegisterInfo() { // Commonly, this method is overridden and g_register_infos is copied and - // specialized. - // So, use GetRegisterInfo() rather than g_register_infos in this scope. + // specialized. So, use GetRegisterInfo() rather than g_register_infos in + // this scope. return m_register_info_ap->GetRegisterInfo(); } @@ -531,8 +531,8 @@ return (set_index < num_sets); } -// Used when parsing DWARF and EH frame information and any other -// object file sections that contain register numbers in them. +// Used when parsing DWARF and EH frame information and any other object file +// sections that contain register numbers in them. uint32_t RegisterContextPOSIX_x86::ConvertRegisterKindToRegisterNumber( lldb::RegisterKind kind, uint32_t num) { const uint32_t num_regs = GetRegisterCount(); Index: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp +++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp @@ -356,8 +356,8 @@ if (exc_code == 0x10003) // EXC_SOFT_SIGNAL { if (exc_sub_code == 5) { - // On MacOSX, a SIGTRAP can signify that a process has called - // exec, so we should check with our dynamic loader to verify. + // On MacOSX, a SIGTRAP can signify that a process has called exec, + // so we should check with our dynamic loader to verify. ProcessSP process_sp(thread.GetProcess()); if (process_sp) { DynamicLoader *dynamic_loader = process_sp->GetDynamicLoader(); @@ -403,10 +403,8 @@ if (!exc_sub_code) { // This looks like a plain trap. // Have to check if there is a breakpoint here as well. When you - // single-step onto a trap, - // the single step stops you not to trap. Since we also do that - // check below, let's just use - // that logic. + // single-step onto a trap, the single step stops you not to trap. + // Since we also do that check below, let's just use that logic. is_actual_breakpoint = true; is_trace_if_actual_breakpoint_missing = true; } else { @@ -419,8 +417,8 @@ (lldb::addr_t)exc_sub_code); if (wp_sp && wp_sp->IsEnabled()) { // Debugserver may piggyback the hardware index of the fired - // watchpoint in the exception data. - // Set the hardware index if that's the case. + // watchpoint in the exception data. Set the hardware index if + // that's the case. if (exc_data_count >= 3) wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); return StopInfo::CreateStopReasonWithWatchpointID(thread, @@ -450,16 +448,15 @@ if (exc_code == 0x102) // EXC_ARM_DA_DEBUG { // It's a watchpoint, then, if the exc_sub_code indicates a - // known/enabled - // data break address from our watchpoint list. + // known/enabled data break address from our watchpoint list. lldb::WatchpointSP wp_sp; if (target) wp_sp = target->GetWatchpointList().FindByAddress( (lldb::addr_t)exc_sub_code); if (wp_sp && wp_sp->IsEnabled()) { // Debugserver may piggyback the hardware index of the fired - // watchpoint in the exception data. - // Set the hardware index if that's the case. + // watchpoint in the exception data. Set the hardware index if + // that's the case. if (exc_data_count >= 3) wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); return StopInfo::CreateStopReasonWithWatchpointID(thread, @@ -473,9 +470,9 @@ is_actual_breakpoint = true; is_trace_if_actual_breakpoint_missing = true; } else if (exc_code == 0) // FIXME not EXC_ARM_BREAKPOINT but a kernel - // is currently returning this so accept it as - // indicating a breakpoint until the kernel is - // fixed + // is currently returning this so accept it + // as indicating a breakpoint until the + // kernel is fixed { is_actual_breakpoint = true; is_trace_if_actual_breakpoint_missing = true; @@ -493,16 +490,15 @@ if (exc_code == 0x102) // EXC_ARM_DA_DEBUG { // It's a watchpoint, then, if the exc_sub_code indicates a - // known/enabled - // data break address from our watchpoint list. + // known/enabled data break address from our watchpoint list. lldb::WatchpointSP wp_sp; if (target) wp_sp = target->GetWatchpointList().FindByAddress( (lldb::addr_t)exc_sub_code); if (wp_sp && wp_sp->IsEnabled()) { // Debugserver may piggyback the hardware index of the fired - // watchpoint in the exception data. - // Set the hardware index if that's the case. + // watchpoint in the exception data. Set the hardware index if + // that's the case. if (exc_data_count >= 3) wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code); return StopInfo::CreateStopReasonWithWatchpointID(thread, @@ -514,8 +510,7 @@ return StopInfo::CreateStopReasonToTrace(thread); } // It looks like exc_sub_code has the 4 bytes of the instruction that - // triggered the - // exception, i.e. our breakpoint opcode + // triggered the exception, i.e. our breakpoint opcode is_actual_breakpoint = exc_code == 1; break; } @@ -534,23 +529,21 @@ if (process_sp) bp_site_sp = process_sp->GetBreakpointSiteList().FindByAddress(pc); if (bp_site_sp && bp_site_sp->IsEnabled()) { - // Update the PC if we were asked to do so, but only do - // so if we find a breakpoint that we know about cause - // this could be a trap instruction in the code + // Update the PC if we were asked to do so, but only do so if we find + // a breakpoint that we know about cause this could be a trap + // instruction in the code if (pc_decrement > 0 && adjust_pc_if_needed) reg_ctx_sp->SetPC(pc); // If the breakpoint is for this thread, then we'll report the hit, - // but if it is for another thread, - // we can just report no reason. We don't need to worry about - // stepping over the breakpoint here, that + // but if it is for another thread, we can just report no reason. We + // don't need to worry about stepping over the breakpoint here, that // will be taken care of when the thread resumes and notices that - // there's a breakpoint under the pc. - // If we have an operating system plug-in, we might have set a thread - // specific breakpoint using the + // there's a breakpoint under the pc. If we have an operating system + // plug-in, we might have set a thread specific breakpoint using the // operating system thread ID, so we can't make any assumptions about - // the thread ID so we must always - // report the breakpoint regardless of the thread. + // the thread ID so we must always report the breakpoint regardless + // of the thread. if (bp_site_sp->ValidForThisThread(&thread) || thread.GetProcess()->GetOperatingSystem() != NULL) return StopInfo::CreateStopReasonWithBreakpointSiteID( Index: lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp +++ lldb/trunk/source/Plugins/Process/Utility/UnwindLLDB.cpp @@ -132,16 +132,12 @@ // We want to detect an unwind that cycles erroneously and stop backtracing. // Don't want this maximum unwind limit to be too low -- if you have a - // backtrace - // with an "infinitely recursing" bug, it will crash when the stack blows out - // and the first 35,000 frames are uninteresting - it's the top most 5 frames - // that - // you actually care about. So you can't just cap the unwind at 10,000 or - // something. - // Realistically anything over around 200,000 is going to blow out the stack - // space. - // If we're still unwinding at that point, we're probably never going to - // finish. + // backtrace with an "infinitely recursing" bug, it will crash when the stack + // blows out and the first 35,000 frames are uninteresting - it's the top + // most 5 frames that you actually care about. So you can't just cap the + // unwind at 10,000 or something. Realistically anything over around 200,000 + // is going to blow out the stack space. If we're still unwinding at that + // point, we're probably never going to finish. if (cur_idx > 300000) { if (log) log->Printf("%*sFrame %d unwound too many frames, assuming unwind has " @@ -152,13 +148,12 @@ if (reg_ctx_sp.get() == NULL) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to - // that and return - // true. Subsequent calls to TryFallbackUnwindPlan() will return false. + // that and return true. Subsequent calls to TryFallbackUnwindPlan() will + // return false. if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be updated. - // Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of prev_frame + // still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -172,15 +167,13 @@ } if (!reg_ctx_sp->IsValid()) { - // We failed to get a valid RegisterContext. - // See if the regctx below this on the stack has a fallback unwind plan it - // can use. - // Subsequent calls to TryFallbackUnwindPlan() will return false. + // We failed to get a valid RegisterContext. See if the regctx below this + // on the stack has a fallback unwind plan it can use. Subsequent calls to + // TryFallbackUnwindPlan() will return false. if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be updated. - // Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of prev_frame + // still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -195,13 +188,12 @@ } if (!reg_ctx_sp->GetCFA(cursor_sp->cfa)) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to - // that and return - // true. Subsequent calls to TryFallbackUnwindPlan() will return false. + // that and return true. Subsequent calls to TryFallbackUnwindPlan() will + // return false. if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be updated. - // Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of prev_frame + // still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -216,27 +208,21 @@ } if (abi && !abi->CallFrameAddressIsValid(cursor_sp->cfa)) { // On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not - // have - // its (constructed) CFA aligned correctly -- don't do the abi alignment - // check for - // these. + // have its (constructed) CFA aligned correctly -- don't do the abi + // alignment check for these. if (reg_ctx_sp->IsTrapHandlerFrame() == false) { // See if we can find a fallback unwind plan for THIS frame. It may be // that the UnwindPlan we're using for THIS frame was bad and gave us a - // bad CFA. - // If that's not it, then see if we can change the UnwindPlan for the - // frame - // below us ("NEXT") -- see if using that other UnwindPlan gets us a - // better - // unwind state. + // bad CFA. If that's not it, then see if we can change the UnwindPlan + // for the frame below us ("NEXT") -- see if using that other UnwindPlan + // gets us a better unwind state. if (reg_ctx_sp->TryFallbackUnwindPlan() == false || reg_ctx_sp->GetCFA(cursor_sp->cfa) == false || abi->CallFrameAddressIsValid(cursor_sp->cfa) == false) { if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be - // updated. Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of + // prev_frame still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -259,13 +245,12 @@ } if (!reg_ctx_sp->ReadPC(cursor_sp->start_pc)) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to - // that and return - // true. Subsequent calls to TryFallbackUnwindPlan() will return false. + // that and return true. Subsequent calls to TryFallbackUnwindPlan() will + // return false. if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be updated. - // Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of prev_frame + // still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -280,13 +265,12 @@ } if (abi && !abi->CodeAddressIsValid(cursor_sp->start_pc)) { // If the RegisterContextLLDB has a fallback UnwindPlan, it will switch to - // that and return - // true. Subsequent calls to TryFallbackUnwindPlan() will return false. + // that and return true. Subsequent calls to TryFallbackUnwindPlan() will + // return false. if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // TryFallbackUnwindPlan for prev_frame succeeded and updated - // reg_ctx_lldb_sp field of - // prev_frame. However, cfa field of prev_frame still needs to be updated. - // Hence updating it. + // reg_ctx_lldb_sp field of prev_frame. However, cfa field of prev_frame + // still needs to be updated. Hence updating it. if (!(prev_frame->reg_ctx_lldb_sp->GetCFA(prev_frame->cfa))) return nullptr; @@ -320,13 +304,12 @@ CursorSP old_m_candidate_frame = m_candidate_frame; // Try to unwind 2 more frames using the Unwinder. It uses Full UnwindPlan - // and if Full UnwindPlan fails, then uses FallBack UnwindPlan. Also - // update the cfa of Frame 0 (if required). + // and if Full UnwindPlan fails, then uses FallBack UnwindPlan. Also update + // the cfa of Frame 0 (if required). AddOneMoreFrame(abi); - // Remove all the frames added by above function as the purpose of - // using above function was just to check whether Unwinder of Frame 0 - // works or not. + // Remove all the frames added by above function as the purpose of using + // above function was just to check whether Unwinder of Frame 0 works or not. for (uint32_t i = 1; i < m_frames.size(); i++) m_frames.pop_back(); @@ -362,51 +345,44 @@ m_frames.push_back(new_frame); - // If we can get one more frame further then accept that we get back a correct - // frame. + // If we can get one more frame further then accept that we get back a + // correct frame. m_candidate_frame = GetOneMoreFrame(abi); if (m_candidate_frame) return true; // We can't go further from the frame returned by GetOneMore frame. Lets try - // to get a - // different frame with using the fallback unwind plan. + // to get a different frame with using the fallback unwind plan. if (!m_frames[m_frames.size() - 2] ->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) { // We don't have a valid fallback unwind plan. Accept the frame as it is. - // This is a - // valid situation when we are at the bottom of the stack. + // This is a valid situation when we are at the bottom of the stack. return true; } // Remove the possibly incorrect frame from the frame list and try to add a - // different one with - // the newly selected fallback unwind plan. + // different one with the newly selected fallback unwind plan. m_frames.pop_back(); CursorSP new_frame_v2 = GetOneMoreFrame(abi); if (new_frame_v2 == nullptr) { // We haven't got a new frame from the fallback unwind plan. Accept the - // frame from the - // original unwind plan. This is a valid situation when we are at the bottom - // of the stack. + // frame from the original unwind plan. This is a valid situation when we + // are at the bottom of the stack. m_frames.push_back(new_frame); return true; } // Push the new frame to the list and try to continue from this frame. If we - // can get a new frame - // then accept it as the correct one. + // can get a new frame then accept it as the correct one. m_frames.push_back(new_frame_v2); m_candidate_frame = GetOneMoreFrame(abi); if (m_candidate_frame) { // If control reached here then TryFallbackUnwindPlan had succeeded for - // Cursor::m_frames[m_frames.size() - 2]. - // It also succeeded to Unwind next 2 frames i.e. m_frames[m_frames.size() - - // 1] and a frame after that. - // For Cursor::m_frames[m_frames.size() - 2], reg_ctx_lldb_sp field was - // already updated during TryFallbackUnwindPlan - // call above. However, cfa field still needs to be updated. Hence updating - // it here and then returning. + // Cursor::m_frames[m_frames.size() - 2]. It also succeeded to Unwind next + // 2 frames i.e. m_frames[m_frames.size() - 1] and a frame after that. For + // Cursor::m_frames[m_frames.size() - 2], reg_ctx_lldb_sp field was already + // updated during TryFallbackUnwindPlan call above. However, cfa field + // still needs to be updated. Hence updating it here and then returning. if (!(m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA( m_frames[m_frames.size() - 2]->cfa))) return false; @@ -414,8 +390,7 @@ } // The new frame hasn't helped in unwinding. Fall back to the original one as - // the default unwind - // plan is usually more reliable then the fallback one. + // the default unwind plan is usually more reliable then the fallback one. m_frames.pop_back(); m_frames.push_back(new_frame); return true; @@ -486,10 +461,9 @@ if (static_cast(frame_num) >= m_frames.size()) return false; - // Never interrogate more than one level while looking for the saved pc value. - // If the value - // isn't saved by frame_num, none of the frames lower on the stack will have a - // useful value. + // Never interrogate more than one level while looking for the saved pc + // value. If the value isn't saved by frame_num, none of the frames lower on + // the stack will have a useful value. if (pc_reg) { UnwindLLDB::RegisterSearchResult result; result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister( @@ -505,8 +479,7 @@ lldb_regnum, regloc); // We descended down to the live register context aka stack frame 0 and are - // reading the value - // out of a live register. + // reading the value out of a live register. if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound && regloc.type == UnwindLLDB::RegisterLocation::eRegisterInLiveRegisterContext) { @@ -514,11 +487,9 @@ } // If we have unwind instructions saying that register N is saved in - // register M in the middle of - // the stack (and N can equal M here, meaning the register was not used in - // this function), then - // change the register number we're looking for to M and keep looking for a - // concrete location + // register M in the middle of the stack (and N can equal M here, meaning + // the register was not used in this function), then change the register + // number we're looking for to M and keep looking for a concrete location // down the stack, or an actual value from a live RegisterContext at frame // 0. if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound && Index: lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ lldb/trunk/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -133,8 +133,8 @@ if (addr_range_ptr) { if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress()) { - // We are at the first instruction, so we can recover the - // previous PC by dereferencing the SP + // We are at the first instruction, so we can recover the previous PC + // by dereferencing the SP lldb::addr_t first_frame_sp = reg_ctx->GetSP(0); // Read the real second frame return address into frame.pc if (first_frame_sp && @@ -224,8 +224,8 @@ if (addr_range_ptr) { if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress()) { - // We are at the first instruction, so we can recover the - // previous PC by dereferencing the SP + // We are at the first instruction, so we can recover the previous PC + // by dereferencing the SP lldb::addr_t first_frame_sp = reg_ctx->GetSP(0); // Read the real second frame return address into frame.pc if (process->ReadMemory(first_frame_sp, &frame.pc, sizeof(frame.pc), Index: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp @@ -112,8 +112,7 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadLaunchRoutine( const ProcessLaunchInfo &launch_info) { // Grab a shared_ptr reference to this so that we know it won't get deleted - // until after the - // thread routine has exited. + // until after the thread routine has exited. std::shared_ptr this_ref(shared_from_this()); Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); @@ -124,14 +123,11 @@ ProcessLauncherWindows launcher; HostProcess process(launcher.LaunchProcess(launch_info, error)); // If we couldn't create the process, notify waiters immediately. Otherwise - // enter the debug - // loop and wait until we get the create process debug notification. Note - // that if the process - // was created successfully, we can throw away the process handle we got from - // CreateProcess - // because Windows will give us another (potentially more useful?) handle when - // it sends us the - // CREATE_PROCESS_DEBUG_EVENT. + // enter the debug loop and wait until we get the create process debug + // notification. Note that if the process was created successfully, we can + // throw away the process handle we got from CreateProcess because Windows + // will give us another (potentially more useful?) handle when it sends us + // the CREATE_PROCESS_DEBUG_EVENT. if (error.Success()) DebugLoop(); else @@ -143,8 +139,7 @@ lldb::thread_result_t DebuggerThread::DebuggerThreadAttachRoutine( lldb::pid_t pid, const ProcessAttachInfo &attach_info) { // Grab a shared_ptr reference to this so that we know it won't get deleted - // until after the - // thread routine has exited. + // until after the thread routine has exited. std::shared_ptr this_ref(shared_from_this()); Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); @@ -157,11 +152,9 @@ return 0; } - // The attach was successful, enter the debug loop. From here on out, this is - // no different than - // a create process operation, so all the same comments in DebugLaunch should - // apply from this - // point out. + // The attach was successful, enter the debug loop. From here on out, this + // is no different than a create process operation, so all the same comments + // in DebugLaunch should apply from this point out. DebugLoop(); return 0; @@ -189,8 +182,8 @@ if (terminate) { // Initiate the termination before continuing the exception, so that the - // next debug - // event we get is the exit process event, and not some other event. + // next debug event we get is the exit process event, and not some other + // event. BOOL terminate_suceeded = TerminateProcess(handle, 0); LLDB_LOG(log, "calling TerminateProcess({0}, 0) (inferior={1}), success={2}", @@ -198,11 +191,9 @@ } // If we're stuck waiting for an exception to continue (e.g. the user is at a - // breakpoint - // messing around in the debugger), continue it now. But only AFTER calling - // TerminateProcess - // to make sure that the very next call to WaitForDebugEvent is an exit - // process event. + // breakpoint messing around in the debugger), continue it now. But only + // AFTER calling TerminateProcess to make sure that the very next call to + // WaitForDebugEvent is an exit process event. if (m_active_exception.get()) { LLDB_LOG(log, "masking active exception"); ContinueAsyncException(ExceptionResult::MaskException); @@ -355,8 +346,7 @@ } // Don't perform any blocking operations while we're shutting down. That - // will - // cause TerminateProcess -> WaitForSingleObject to time out. + // will cause TerminateProcess -> WaitForSingleObject to time out. return ExceptionResult::SendToApplication; } Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -77,8 +77,8 @@ namespace lldb_private { // We store a pointer to this class in the ProcessWindows, so that we don't -// expose Windows-specific types and implementation details from a public header -// file. +// expose Windows-specific types and implementation details from a public +// header file. class ProcessWindowsData { public: ProcessWindowsData(bool stop_at_entry) : m_stop_at_entry(stop_at_entry) { @@ -186,9 +186,9 @@ StateType private_state; { // Acquire the lock only long enough to get the DebuggerThread. - // StopDebugging() will trigger a call back into ProcessWindows which - // will also acquire the lock. Thus we have to release the lock before - // calling StopDebugging(). + // StopDebugging() will trigger a call back into ProcessWindows which will + // also acquire the lock. Thus we have to release the lock before calling + // StopDebugging(). llvm::sys::ScopedLock lock(m_mutex); private_state = GetPrivateState(); @@ -228,11 +228,9 @@ Status ProcessWindows::DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { - // Even though m_session_data is accessed here, it is before a debugger thread - // has been - // kicked off. So there's no race conditions, and it shouldn't be necessary - // to acquire - // the mutex. + // Even though m_session_data is accessed here, it is before a debugger + // thread has been kicked off. So there's no race conditions, and it + // shouldn't be necessary to acquire the mutex. Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); Status result; @@ -276,12 +274,10 @@ launch_info.GetExecutableFile().GetPath()); // We've hit the initial stop. If eLaunchFlagsStopAtEntry was specified, the - // private state - // should already be set to eStateStopped as a result of hitting the initial - // breakpoint. If - // it was not set, the breakpoint should have already been resumed from and - // the private state - // should already be eStateRunning. + // private state should already be set to eStateStopped as a result of + // hitting the initial breakpoint. If it was not set, the breakpoint should + // have already been resumed from and the private state should already be + // eStateRunning. launch_info.SetProcessID(process.GetProcessId()); SetID(process.GetProcessId()); @@ -322,12 +318,10 @@ LLDB_LOG(log, "successfully attached to process with pid={0}", process_id); // We've hit the initial stop. If eLaunchFlagsStopAtEntry was specified, the - // private state - // should already be set to eStateStopped as a result of hitting the initial - // breakpoint. If - // it was not set, the breakpoint should have already been resumed from and - // the private state - // should already be eStateRunning. + // private state should already be set to eStateStopped as a result of + // hitting the initial breakpoint. If it was not set, the breakpoint should + // have already been resumed from and the private state should already be + // eStateRunning. SetID(process.GetProcessId()); return error; } @@ -346,9 +340,9 @@ ExceptionRecordSP active_exception = m_session_data->m_debugger->GetActiveException().lock(); if (active_exception) { - // Resume the process and continue processing debug events. Mask - // the exception so that from the process's view, there is no - // indication that anything happened. + // Resume the process and continue processing debug events. Mask the + // exception so that from the process's view, there is no indication that + // anything happened. m_session_data->m_debugger->ContinueAsyncException( ExceptionResult::MaskException); } @@ -376,10 +370,9 @@ StateType private_state; { // Acquire this lock inside an inner scope, only long enough to get the - // DebuggerThread. - // StopDebugging() will trigger a call back into ProcessWindows which will - // acquire the lock - // again, so we need to not deadlock. + // DebuggerThread. StopDebugging() will trigger a call back into + // ProcessWindows which will acquire the lock again, so we need to not + // deadlock. llvm::sys::ScopedLock lock(m_mutex); private_state = GetPrivateState(); @@ -558,8 +551,8 @@ ModuleSP exe_module_sp(target_sp->GetExecutableModule()); if (exe_module_sp.get()) return exe_module_sp->GetFileSpec().Exists(); - // However, if there is no executable module, we return true since we might be - // preparing to attach. + // However, if there is no executable module, we return true since we might + // be preparing to attach. return true; } @@ -589,8 +582,8 @@ } } - // Also add all the threads that are new since the last time we broke into the - // debugger. + // Also add all the threads that are new since the last time we broke into + // the debugger. for (const auto &thread_info : m_session_data->m_new_threads) { ThreadSP thread(new TargetThreadWindows(*this, thread_info.second)); thread->SetID(thread_info.first); @@ -699,11 +692,9 @@ SIZE_T result = ::VirtualQueryEx(handle, addr, &mem_info, sizeof(mem_info)); if (result == 0) { if (::GetLastError() == ERROR_INVALID_PARAMETER) { - // ERROR_INVALID_PARAMETER is returned if VirtualQueryEx is called with an - // address - // past the highest accessible address. We should return a range from the - // vm_addr - // to LLDB_INVALID_ADDRESS + // ERROR_INVALID_PARAMETER is returned if VirtualQueryEx is called with + // an address past the highest accessible address. We should return a + // range from the vm_addr to LLDB_INVALID_ADDRESS info.GetRange().SetRangeBase(vm_addr); info.GetRange().SetRangeEnd(LLDB_INVALID_ADDRESS); info.SetReadable(MemoryRegionInfo::eNo); @@ -744,10 +735,8 @@ info.SetMapped(MemoryRegionInfo::eYes); } else { // In the unmapped case we need to return the distance to the next block of - // memory. - // VirtualQueryEx nearly does that except that it gives the distance from - // the start - // of the page containing vm_addr. + // memory. VirtualQueryEx nearly does that except that it gives the + // distance from the start of the page containing vm_addr. SYSTEM_INFO data; GetSystemInfo(&data); DWORD page_offset = vm_addr % data.dwPageSize; @@ -825,10 +814,9 @@ GetTarget().ModulesDidLoad(loaded_modules); // Add the main executable module to the list of pending module loads. We - // can't call - // GetTarget().ModulesDidLoad() here because we still haven't returned from - // DoLaunch() / DoAttach() yet - // so the target may not have set the process instance to `this` yet. + // can't call GetTarget().ModulesDidLoad() here because we still haven't + // returned from DoLaunch() / DoAttach() yet so the target may not have set + // the process instance to `this` yet. llvm::sys::ScopedLock lock(m_mutex); const HostThreadWindows &wmain_thread = debugger->GetMainThread().GetNativeThread(); @@ -845,12 +833,10 @@ // FIXME: Without this check, occasionally when running the test suite there // is // an issue where m_session_data can be null. It's not clear how this could - // happen - // but it only surfaces while running the test suite. In order to properly - // diagnose - // this, we probably need to first figure allow the test suite to print out - // full - // lldb logs, and then add logging to the process plugin. + // happen but it only surfaces while running the test suite. In order to + // properly diagnose this, we probably need to first figure allow the test + // suite to print out full lldb logs, and then add logging to the process + // plugin. if (!m_session_data) { LLDB_LOG(log, "Debugger thread reported exception {0:x} at address {1:x}, " "but there is no session.", @@ -929,9 +915,8 @@ void ProcessWindows::OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr) { // Confusingly, there is no Target::AddSharedModule. Instead, calling - // GetSharedModule() with - // a new module will add it to the module list and return a corresponding - // ModuleSP. + // GetSharedModule() with a new module will add it to the module list and + // return a corresponding ModuleSP. Status error; ModuleSP module = GetTarget().GetSharedModule(module_spec, &error); bool load_addr_changed = false; @@ -961,17 +946,15 @@ Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS); if (m_session_data->m_initial_stop_received) { - // This happened while debugging. Do we shutdown the debugging session, try - // to continue, or do something else? + // This happened while debugging. Do we shutdown the debugging session, + // try to continue, or do something else? LLDB_LOG(log, "Error {0} occurred during debugging. Unexpected behavior " "may result. {1}", error.GetError(), error); } else { // If we haven't actually launched the process yet, this was an error - // launching the - // process. Set the internal error and signal the initial stop event so - // that the DoLaunch - // method wakes up and returns a failure. + // launching the process. Set the internal error and signal the initial + // stop event so that the DoLaunch method wakes up and returns a failure. m_session_data->m_launch_error = error; ::SetEvent(m_session_data->m_initial_stop_event); LLDB_LOG( @@ -1001,9 +984,9 @@ } // The Windows page protection bits are NOT independent masks that can be -// bitwise-ORed together. For example, PAGE_EXECUTE_READ is not -// (PAGE_EXECUTE | PAGE_READ). To test for an access type, it's necessary to -// test for any of the bits that provide that access type. +// bitwise-ORed together. For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE +// | PAGE_READ). To test for an access type, it's necessary to test for any of +// the bits that provide that access type. bool ProcessWindows::IsPageReadable(uint32_t protect) { return (protect & PAGE_NOACCESS) == 0; } Index: lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/x64/RegisterContextWindows_x64.cpp @@ -29,14 +29,11 @@ namespace { // This enum defines the layout of the global RegisterInfo array. This is -// necessary because -// lldb register sets are defined in terms of indices into the register array. -// As such, the -// order of RegisterInfos defined in global registers array must match the order -// defined here. -// When defining the register set layouts, these values can appear in an -// arbitrary order, and that -// determines the order that register values are displayed in a dump. +// necessary because lldb register sets are defined in terms of indices into +// the register array. As such, the order of RegisterInfos defined in global +// registers array must match the order defined here. When defining the +// register set layouts, these values can appear in an arbitrary order, and +// that determines the order that register values are displayed in a dump. enum RegisterIndex { eRegisterIndexRax, eRegisterIndexRbx, @@ -270,11 +267,10 @@ bool RegisterContextWindows_x64::WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) { - // Since we cannot only write a single register value to the inferior, we need - // to make sure - // our cached copy of the register values are fresh. Otherwise when writing - // EAX, for example, - // we may also overwrite some other register with a stale value. + // Since we cannot only write a single register value to the inferior, we + // need to make sure our cached copy of the register values are fresh. + // Otherwise when writing EAX, for example, we may also overwrite some other + // register with a stale value. if (!CacheAllRegisterValues()) return false; Index: lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp @@ -30,14 +30,11 @@ namespace { // This enum defines the layout of the global RegisterInfo array. This is -// necessary because -// lldb register sets are defined in terms of indices into the register array. -// As such, the -// order of RegisterInfos defined in global registers array must match the order -// defined here. -// When defining the register set layouts, these values can appear in an -// arbitrary order, and that -// determines the order that register values are displayed in a dump. +// necessary because lldb register sets are defined in terms of indices into +// the register array. As such, the order of RegisterInfos defined in global +// registers array must match the order defined here. When defining the +// register set layouts, these values can appear in an arbitrary order, and +// that determines the order that register values are displayed in a dump. enum RegisterIndex { eRegisterIndexEax, eRegisterIndexEbx, @@ -212,11 +209,10 @@ bool RegisterContextWindows_x86::WriteRegister(const RegisterInfo *reg_info, const RegisterValue ®_value) { - // Since we cannot only write a single register value to the inferior, we need - // to make sure - // our cached copy of the register values are fresh. Otherwise when writing - // EAX, for example, - // we may also overwrite some other register with a stale value. + // Since we cannot only write a single register value to the inferior, we + // need to make sure our cached copy of the register values are fresh. + // Otherwise when writing EAX, for example, we may also overwrite some other + // register with a stale value. if (!CacheAllRegisterValues()) return false; Index: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -56,9 +56,9 @@ const FileSpec *crash_file) { lldb::ProcessSP process_sp; if (crash_file) { - // Read enough data for a ELF32 header or ELF64 header - // Note: Here we care about e_type field only, so it is safe - // to ignore possible presence of the header extension. + // Read enough data for a ELF32 header or ELF64 header Note: Here we care + // about e_type field only, so it is safe to ignore possible presence of + // the header extension. const size_t header_size = sizeof(llvm::ELF::Elf64_Ehdr); auto data_sp = DataBufferLLVM::CreateSliceFromPath(crash_file->GetPath(), @@ -107,10 +107,10 @@ //---------------------------------------------------------------------- ProcessElfCore::~ProcessElfCore() { Clear(); - // We need to call finalize on the process before destroying ourselves - // to make sure all of the broadcaster cleanup goes as planned. If we - // destruct this class, then Process::~Process() might have problems - // trying to fully destroy the broadcaster. + // We need to call finalize on the process before destroying ourselves to + // make sure all of the broadcaster cleanup goes as planned. If we destruct + // this class, then Process::~Process() might have problems trying to fully + // destroy the broadcaster. Finalize(); } @@ -206,8 +206,8 @@ m_core_range_infos.Sort(); } - // Even if the architecture is set in the target, we need to override - // it to match the core file which is always single arch. + // Even if the architecture is set in the target, we need to override it to + // match the core file which is always single arch. ArchSpec arch(m_core_module_sp->GetArchitecture()); ArchSpec target_arch = GetTarget().GetArchitecture(); @@ -241,8 +241,7 @@ } // Core files are useless without the main executable. See if we can locate - // the main - // executable using data we found in the core file notes. + // the main executable using data we found in the core file notes. lldb::ModuleSP exe_module_sp = GetTarget().GetExecutableModule(); if (!exe_module_sp) { // The first entry in the NT_FILE might be our executable @@ -297,8 +296,8 @@ //------------------------------------------------------------------ size_t ProcessElfCore::ReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) { - // Don't allow the caching that lldb_private::Process::ReadMemory does - // since in core files we have it all cached our our core file anyway. + // Don't allow the caching that lldb_private::Process::ReadMemory does since + // in core files we have it all cached our our core file anyway. return DoReadMemory(addr, buf, size, error); } @@ -368,17 +367,18 @@ lldb::addr_t bytes_left = 0; // Number of bytes available in the core file from the given address - // Don't proceed if core file doesn't contain the actual data for this address range. + // Don't proceed if core file doesn't contain the actual data for this + // address range. if (file_start == file_end) return 0; - // Figure out how many on-disk bytes remain in this segment - // starting at the given offset + // Figure out how many on-disk bytes remain in this segment starting at the + // given offset if (file_end > file_start + offset) bytes_left = file_end - (file_start + offset); - // Figure out how many bytes we need to zero-fill if we are - // reading more bytes than available in the on-disk segment + // Figure out how many bytes we need to zero-fill if we are reading more + // bytes than available in the on-disk segment if (bytes_to_read > bytes_left) { zero_fill_size = bytes_to_read - bytes_left; bytes_to_read = bytes_left; @@ -551,8 +551,8 @@ llvm::Error ProcessElfCore::parseNetBSDNotes(llvm::ArrayRef notes) { ThreadData thread_data; for (const auto ¬e : notes) { - // NetBSD per-thread information is stored in notes named - // "NetBSD-CORE@nnn" so match on the initial part of the string. + // NetBSD per-thread information is stored in notes named "NetBSD-CORE@nnn" + // so match on the initial part of the string. if (!llvm::StringRef(note.info.n_name).startswith("NetBSD-CORE")) continue; @@ -585,8 +585,8 @@ llvm::Error ProcessElfCore::parseOpenBSDNotes(llvm::ArrayRef notes) { ThreadData thread_data; for (const auto ¬e : notes) { - // OpenBSD per-thread information is stored in notes named - // "OpenBSD@nnn" so match on the initial part of the string. + // OpenBSD per-thread information is stored in notes named "OpenBSD@nnn" so + // match on the initial part of the string. if (!llvm::StringRef(note.info.n_name).startswith("OpenBSD")) continue; @@ -749,9 +749,9 @@ ArchSpec target_arch = GetTarget().GetArchitecture(); arch.MergeFrom(target_arch); - // On MIPS there is no way to differentiate betwenn 32bit and 64bit core files - // and this information can't be merged in from the target arch so we fail - // back to unconditionally returning the target arch in this config. + // On MIPS there is no way to differentiate betwenn 32bit and 64bit core + // files and this information can't be merged in from the target arch so we + // fail back to unconditionally returning the target arch in this config. if (target_arch.IsMIPS()) { return target_arch; } Index: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp @@ -56,7 +56,7 @@ if (IsGPR(reg_info->kinds[lldb::eRegisterKindLLDB])) { if (reg_info->byte_size == 4 && !(arch.GetMachine() == llvm::Triple::mips64el)) // In case of 32bit core file, the register data are placed at 4 byte - // offset. + // offset. offset = offset / 2; v = m_gpr.GetMaxU64(&offset, reg_info->byte_size); value = v; Index: lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp @@ -60,8 +60,8 @@ const uint8_t *src; size_t offset; const size_t fxsave_offset = reg_info->byte_offset - GetFXSAVEOffset(); - // make the offset relative to the beginning of the FXSAVE structure - // because this is the data that we have (not the entire UserArea) + // make the offset relative to the beginning of the FXSAVE structure because + // this is the data that we have (not the entire UserArea) if (m_gpregset && reg_info->byte_offset < GetGPRSize()) { src = m_gpregset.get(); Index: lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp +++ lldb/trunk/source/Plugins/Process/elf-core/ThreadElfCore.cpp @@ -292,8 +292,8 @@ return error; } - // Read field by field to correctly account for endianess - // of both the core dump and the platform running lldb. + // Read field by field to correctly account for endianess of both the core + // dump and the platform running lldb. offset_t offset = 0; si_signo = data.GetU32(&offset); si_code = data.GetU32(&offset); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp @@ -109,16 +109,14 @@ const bool should_stop = ShouldStop(signals, response); response.SetFilePos(0); - // The packet we should resume with. In the future - // we should check our thread list and "do the right thing" - // for new threads that show up while we stop and run async - // packets. Setting the packet to 'c' to continue all threads - // is the right thing to do 99.99% of the time because if a - // thread was single stepping, and we sent an interrupt, we - // will notice above that we didn't stop due to an interrupt - // but stopped due to stepping and we would _not_ continue. - // This packet may get modified by the async actions (e.g. to send a - // signal). + // The packet we should resume with. In the future we should check our + // thread list and "do the right thing" for new threads that show up + // while we stop and run async packets. Setting the packet to 'c' to + // continue all threads is the right thing to do 99.99% of the time + // because if a thread was single stepping, and we sent an interrupt, we + // will notice above that we didn't stop due to an interrupt but stopped + // due to stepping and we would _not_ continue. This packet may get + // modified by the async actions (e.g. to send a signal). m_continue_packet = 'c'; cont_lock.unlock(); @@ -263,19 +261,16 @@ if (m_async_count == 0) return true; // We were not interrupted. The process stopped on its own. - // Older debugserver stubs (before April 2016) can return two - // stop-reply packets in response to a ^C packet. - // Additionally, all debugservers still return two stop replies if - // the inferior stops due to some other reason before the remote - // stub manages to interrupt it. We need to wait for this - // additional packet to make sure the packet sequence does not get - // skewed. + // Older debugserver stubs (before April 2016) can return two stop-reply + // packets in response to a ^C packet. Additionally, all debugservers still + // return two stop replies if the inferior stops due to some other reason + // before the remote stub manages to interrupt it. We need to wait for this + // additional packet to make sure the packet sequence does not get skewed. StringExtractorGDBRemote extra_stop_reply_packet; ReadPacket(extra_stop_reply_packet, milliseconds(100), false); - // Interrupting is typically done using SIGSTOP or SIGINT, so if - // the process stops with some other signal, we definitely want to - // stop. + // Interrupting is typically done using SIGSTOP or SIGINT, so if the process + // stops with some other signal, we definitely want to stop. const uint8_t signo = response.GetHexU8(UINT8_MAX); if (signo != signals.GetSignalNumberFromName("SIGSTOP") && signo != signals.GetSignalNumberFromName("SIGINT")) Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -150,9 +150,8 @@ Disconnect(); } - // Stop the communications read thread which is used to parse all - // incoming packets. This function will block until the read - // thread returns. + // Stop the communications read thread which is used to parse all incoming + // packets. This function will block until the read thread returns. if (m_read_thread_enabled) StopReadThread(); } @@ -217,12 +216,10 @@ } } - // If logging was just enabled and we have history, then dump out what - // we have to the log so we get the historical context. The Dump() call - // that + // If logging was just enabled and we have history, then dump out what we + // have to the log so we get the historical context. The Dump() call that // logs all of the packet will set a boolean so that we don't dump this - // more - // than once + // more than once if (!m_history.DidDumpToLog()) m_history.Dump(log); @@ -303,8 +300,8 @@ // This function is called when a packet is requested. // A whole packet is popped from the packet queue and returned to the caller. -// Packets are placed into this queue from the communication read thread. -// See GDBRemoteCommunication::AppendBytesToCache. +// Packets are placed into this queue from the communication read thread. See +// GDBRemoteCommunication::AppendBytesToCache. GDBRemoteCommunication::PacketResult GDBRemoteCommunication::PopPacketFromQueue(StringExtractorGDBRemote &response, Timeout timeout) { @@ -424,11 +421,9 @@ break; } else if (successful_responses == 1) { // We got something else back as the first successful - // response, it probably is - // the response to the packet we actually wanted, so copy it - // over if this - // is the first success and continue to try to get the qEcho - // response + // response, it probably is the response to the packet we + // actually wanted, so copy it over if this is the first + // success and continue to try to get the qEcho response packet = echo_response; got_actual_response = true; } @@ -441,14 +436,13 @@ } // We weren't able to sync back up with the server, we must abort - // otherwise - // all responses might not be from the right packets... + // otherwise all responses might not be from the right packets... if (sync_success) { // We timed out, but were able to recover if (got_actual_response) { // We initially timed out, but we did get a response that came in - // before the successful - // reply to our qEcho packet, so lets say everything is fine... + // before the successful reply to our qEcho packet, so lets say + // everything is fine... return PacketResult::Success; } } else { @@ -490,10 +484,9 @@ size_t pkt_size = m_bytes.size(); - // Smallest possible compressed packet is $N#00 - an uncompressed empty reply, - // most commonly indicating - // an unsupported packet. Anything less than 5 characters, it's definitely - // not a compressed packet. + // Smallest possible compressed packet is $N#00 - an uncompressed empty + // reply, most commonly indicating an unsupported packet. Anything less than + // 5 characters, it's definitely not a compressed packet. if (pkt_size < 5) return true; @@ -522,17 +515,15 @@ 1; // The first character of the two hex checksum characters // Normally size_of_first_packet == m_bytes.size() but m_bytes may contain - // multiple packets. - // size_of_first_packet is the size of the initial packet which we'll replace - // with the decompressed - // version of, leaving the rest of m_bytes unmodified. + // multiple packets. size_of_first_packet is the size of the initial packet + // which we'll replace with the decompressed version of, leaving the rest of + // m_bytes unmodified. size_t size_of_first_packet = hash_mark_idx + 3; // Compressed packets ("$C") start with a base10 number which is the size of - // the uncompressed payload, - // then a : and then the compressed data. e.g. $C1024:#00 - // Update content_start and content_length to only include the part - // of the packet. + // the uncompressed payload, then a : and then the compressed data. e.g. + // $C1024:#00 Update content_start and content_length to only include + // the part of the packet. uint64_t decompressed_bufsize = ULONG_MAX; if (m_bytes[1] == 'C') { @@ -581,15 +572,14 @@ } if (m_bytes[1] == 'N') { - // This packet was not compressed -- delete the 'N' character at the - // start and the packet may be processed as-is. + // This packet was not compressed -- delete the 'N' character at the start + // and the packet may be processed as-is. m_bytes.erase(1, 1); return true; } - // Reverse the gdb-remote binary escaping that was done to the compressed text - // to - // guard characters like '$', '#', '}', etc. + // Reverse the gdb-remote binary escaping that was done to the compressed + // text to guard characters like '$', '#', '}', etc. std::vector unescaped_content; unescaped_content.reserve(content_length); size_t i = content_start; @@ -630,12 +620,10 @@ else if (m_compression_type == CompressionType::LZMA) compression_type = COMPRESSION_LZMA; - // If we have the expected size of the decompressed payload, we can allocate - // the right-sized buffer and do it. If we don't have that information, - // we'll - // need to try decoding into a big buffer and if the buffer wasn't big - // enough, - // increase it and try again. + // If we have the expected size of the decompressed payload, we can + // allocate the right-sized buffer and do it. If we don't have that + // information, we'll need to try decoding into a big buffer and if the + // buffer wasn't big enough, increase it and try again. if (decompressed_bufsize != ULONG_MAX && decompressed_buffer != nullptr) { decompressed_bytes = compression_decode_buffer( @@ -723,9 +711,8 @@ // Parse up the packets into gdb remote packets if (!m_bytes.empty()) { - // end_idx must be one past the last valid packet byte. Start - // it off with an invalid value that is the same as the current - // index. + // end_idx must be one past the last valid packet byte. Start it off with + // an invalid value that is the same as the current index. size_t content_start = 0; size_t content_length = 0; size_t total_length = 0; @@ -760,7 +747,8 @@ checksum_idx = hash_pos + 1; // Skip the dollar sign content_start = 1; - // Don't include the # in the content or the $ in the content length + // Don't include the # in the content or the $ in the content + // length content_length = hash_pos - 1; total_length = @@ -774,11 +762,10 @@ break; default: { - // We have an unexpected byte and we need to flush all bad - // data that is in m_bytes, so we need to find the first - // byte that is a '+' (ACK), '-' (NACK), \x03 (CTRL+C interrupt), - // or '$' character (start of packet header) or of course, - // the end of the data in m_bytes... + // We have an unexpected byte and we need to flush all bad data that is + // in m_bytes, so we need to find the first byte that is a '+' (ACK), '-' + // (NACK), \x03 (CTRL+C interrupt), or '$' character (start of packet + // header) or of course, the end of the data in m_bytes... const size_t bytes_len = m_bytes.size(); bool done = false; uint32_t idx; @@ -819,16 +806,14 @@ if (log) { // If logging was just enabled and we have history, then dump out what // we have to the log so we get the historical context. The Dump() call - // that - // logs all of the packet will set a boolean so that we don't dump this - // more - // than once + // that logs all of the packet will set a boolean so that we don't dump + // this more than once if (!m_history.DidDumpToLog()) m_history.Dump(log); bool binary = false; - // Only detect binary for packets that start with a '$' and have a '#CC' - // checksum + // Only detect binary for packets that start with a '$' and have a + // '#CC' checksum if (m_bytes[0] == '$' && total_length > 4) { for (size_t i = 0; !binary && i < total_length; ++i) { unsigned char c = m_bytes[i]; @@ -851,8 +836,8 @@ // Remove binary escaped bytes when displaying the packet... const char ch = m_bytes[i]; if (ch == 0x7d) { - // 0x7d is the escape character. The next character is to - // be XOR'd with 0x20. + // 0x7d is the escape character. The next character is to be + // XOR'd with 0x20. const char escapee = m_bytes[++i] ^ 0x20; strm.Printf("%2.2x", escapee); } else { @@ -880,26 +865,25 @@ // Clear packet_str in case there is some existing data in it. packet_str.clear(); - // Copy the packet from m_bytes to packet_str expanding the - // run-length encoding in the process. - // Reserve enough byte for the most common case (no RLE used) + // Copy the packet from m_bytes to packet_str expanding the run-length + // encoding in the process. Reserve enough byte for the most common case + // (no RLE used) packet_str.reserve(m_bytes.length()); for (std::string::const_iterator c = m_bytes.begin() + content_start; c != m_bytes.begin() + content_end; ++c) { if (*c == '*') { - // '*' indicates RLE. Next character will give us the - // repeat count and previous character is what is to be - // repeated. + // '*' indicates RLE. Next character will give us the repeat count + // and previous character is what is to be repeated. char char_to_repeat = packet_str.back(); // Number of time the previous character is repeated int repeat_count = *++c + 3 - ' '; - // We have the char_to_repeat and repeat_count. Now push - // it in the packet. + // We have the char_to_repeat and repeat_count. Now push it in the + // packet. for (int i = 0; i < repeat_count; ++i) packet_str.push_back(char_to_repeat); } else if (*c == 0x7d) { - // 0x7d is the escape character. The next character is to - // be XOR'd with 0x20. + // 0x7d is the escape character. The next character is to be XOR'd + // with 0x20. char escapee = *++c ^ 0x20; packet_str.push_back(escapee); } else { @@ -1009,8 +993,8 @@ char debugserver_path[PATH_MAX]; FileSpec &debugserver_file_spec = launch_info.GetExecutableFile(); - // Always check to see if we have an environment override for the path - // to the debugserver to use and use it if we do. + // Always check to see if we have an environment override for the path to the + // debugserver to use and use it if we do. const char *env_debugserver_path = getenv("LLDB_DEBUGSERVER_PATH"); if (env_debugserver_path) { debugserver_file_spec.SetFile(env_debugserver_path, false); @@ -1022,8 +1006,7 @@ debugserver_file_spec = g_debugserver_file_spec; bool debugserver_exists = debugserver_file_spec.Exists(); if (!debugserver_exists) { - // The debugserver binary is in the LLDB.framework/Resources - // directory. + // The debugserver binary is in the LLDB.framework/Resources directory. if (HostInfo::GetLLDBPath(ePathTypeSupportExecutableDir, debugserver_file_spec)) { debugserver_file_spec.AppendPathComponent(DEBUGSERVER_BASENAME); @@ -1049,8 +1032,7 @@ __FUNCTION__, debugserver_file_spec.GetPath().c_str()); } // Don't cache the platform specific GDB server binary as it could - // change - // from platform to platform + // change from platform to platform g_debugserver_file_spec.Clear(); } } @@ -1098,14 +1080,14 @@ // once data is written to the pipe, debug server is up and running. Pipe socket_pipe; - // port is null when debug server should listen on domain socket - - // we're not interested in port value but rather waiting for debug server - // to become available. + // port is null when debug server should listen on domain socket - we're + // not interested in port value but rather waiting for debug server to + // become available. if (pass_comm_fd == -1) { if (url) { -// Create a temporary file to get the stdout/stderr and redirect the -// output of the command into this file. We will later read this file -// if all goes well and fill the data into "command_output_ptr" +// Create a temporary file to get the stdout/stderr and redirect the output of +// the command into this file. We will later read this file if all goes well +// and fill the data into "command_output_ptr" #if defined(__APPLE__) // Binding to port zero, we need to figure out what port it ends up // using using a named pipe... @@ -1138,8 +1120,7 @@ #endif } else { // No host and port given, so lets listen on our end and make the - // debugserver - // connect to us.. + // debugserver connect to us.. error = StartListenThread("127.0.0.1", 0); if (error.Fail()) { if (log) @@ -1341,14 +1322,11 @@ } // This function is called via the Communications class read thread when bytes -// become available -// for this connection. This function will consume all incoming bytes and try to -// parse whole -// packets as they become available. Full packets are placed in a queue, so that -// all packet -// requests can simply pop from this queue. Async notification packets will be -// dispatched -// immediately to the ProcessGDBRemote Async thread via an event. +// become available for this connection. This function will consume all +// incoming bytes and try to parse whole packets as they become available. Full +// packets are placed in a queue, so that all packet requests can simply pop +// from this queue. Async notification packets will be dispatched immediately +// to the ProcessGDBRemote Async thread via an event. void GDBRemoteCommunication::AppendBytesToCache(const uint8_t *bytes, size_t len, bool broadcast, lldb::ConnectionStatus status) { @@ -1357,8 +1335,8 @@ while (true) { PacketType type = CheckForPacket(bytes, len, packet); - // scrub the data so we do not pass it back to CheckForPacket - // on future passes of the loop + // scrub the data so we do not pass it back to CheckForPacket on future + // passes of the loop bytes = nullptr; len = 0; @@ -1382,8 +1360,8 @@ // put this packet into an event const char *pdata = packet.GetStringRef().c_str(); - // as the communication class, we are a broadcaster and the - // async thread is tuned to listen to us + // as the communication class, we are a broadcaster and the async thread + // is tuned to listen to us BroadcastEvent(eBroadcastBitGdbReadThreadGotNotify, new EventDataBytes(pdata)); } Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -119,8 +119,8 @@ bool GDBRemoteCommunicationClient::HandshakeWithServer(Status *error_ptr) { ResetDiscoverableSettings(false); - // Start the read thread after we send the handshake ack since if we - // fail to send the handshake ack, there is no reason to continue... + // Start the read thread after we send the handshake ack since if we fail to + // send the handshake ack, there is no reason to continue... if (SendAck()) { // Wait for any responses that might have been queued up in the remote // GDB server and flush them all @@ -130,9 +130,9 @@ packet_result = ReadPacket(response, milliseconds(10), false); // The return value from QueryNoAckModeSupported() is true if the packet - // was sent and _any_ response (including UNIMPLEMENTED) was received), - // or false if no response was received. This quickly tells us if we have - // a live connection to a remote GDB server... + // was sent and _any_ response (including UNIMPLEMENTED) was received), or + // false if no response was received. This quickly tells us if we have a + // live connection to a remote GDB server... if (QueryNoAckModeSupported()) { return true; } else { @@ -215,9 +215,8 @@ m_supports_not_sending_acks = eLazyBoolNo; // This is the first real packet that we'll send in a debug session and it - // may take a little - // longer than normal to receive a reply. Wait at least 6 seconds for a - // reply to this packet. + // may take a little longer than normal to receive a reply. Wait at least + // 6 seconds for a reply to this packet. ScopedTimeout timeout(*this, std::max(GetPacketTimeout(), seconds(6))); @@ -340,8 +339,8 @@ m_supports_jModulesInfo = true; } - // These flags should be reset when we first connect to a GDB server - // and when our inferior process execs + // These flags should be reset when we first connect to a GDB server and when + // our inferior process execs m_qProcessInfo_is_valid = eLazyBoolCalculate; m_process_arch.Clear(); } @@ -373,8 +372,7 @@ const char *response_cstr = response.GetStringRef().c_str(); // Hang on to the qSupported packet, so that platforms can do custom - // configuration of the transport before attaching/launching the - // process. + // configuration of the transport before attaching/launching the process. m_qSupported_response = response_cstr; if (::strstr(response_cstr, "qXfer:auxv:read+")) @@ -393,7 +391,8 @@ m_supports_qXfer_memory_map_read = eLazyBoolYes; // Look for a list of compressions in the features list e.g. - // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib-deflate,lzma + // qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib- + // deflate,lzma const char *features_list = ::strstr(response_cstr, "qXfer:features:"); if (features_list) { const char *compressions = @@ -557,9 +556,8 @@ return SendPacketAndWaitForResponseNoLock(payload.GetString(), response); } -// Check if the target supports 'p' packet. It sends out a 'p' -// packet and checks the response. A normal packet will tell us -// that support is available. +// Check if the target supports 'p' packet. It sends out a 'p' packet and +// checks the response. A normal packet will tell us that support is available. // // Takes a valid thread ID because p needs to apply to a thread. bool GDBRemoteCommunicationClient::GetpPacketSupported(lldb::tid_t tid) { @@ -614,8 +612,8 @@ void GDBRemoteCommunicationClient::EnableErrorStringInPacket() { if (m_supports_error_string_reply == eLazyBoolCalculate) { StringExtractorGDBRemote response; - // We try to enable error strings in remote packets - // but if we fail, we just work in the older way. + // We try to enable error strings in remote packets but if we fail, we just + // work in the older way. m_supports_error_string_reply = eLazyBoolNo; if (SendPacketAndWaitForResponse("QEnableErrorStrings", response, false) == PacketResult::Success) { @@ -729,12 +727,10 @@ return m_curr_pid; } else { // If we don't get a response for qProcessInfo, check if $qC gives us a - // result. - // $qC only returns a real process id on older debugserver and lldb-platform - // stubs. - // The gdb remote protocol documents $qC as returning the thread id, which - // newer - // debugserver and lldb-gdbserver stubs return correctly. + // result. $qC only returns a real process id on older debugserver and + // lldb-platform stubs. The gdb remote protocol documents $qC as returning + // the thread id, which newer debugserver and lldb-gdbserver stubs return + // correctly. StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse("qC", response, false) == PacketResult::Success) { @@ -789,8 +785,8 @@ int GDBRemoteCommunicationClient::SendArgumentsPacket( const ProcessLaunchInfo &launch_info) { // Since we don't get the send argv0 separate from the executable path, we - // need to - // make sure to use the actual executable path found in the launch_info... + // need to make sure to use the actual executable path found in the + // launch_info... std::vector argv; FileSpec exe_file = launch_info.GetExecutableFile(); std::string exe_path; @@ -1558,8 +1554,8 @@ Status qXfer_error = GetQXferMemoryMapRegionInfo(addr, qXfer_region_info); if (error.Fail()) { - // If qMemoryRegionInfo failed, but qXfer:memory-map:read succeeded, - // use the qXfer result as a fallback + // If qMemoryRegionInfo failed, but qXfer:memory-map:read succeeded, use + // the qXfer result as a fallback if (qXfer_error.Success()) { region_info = qXfer_region_info; error.Clear(); @@ -1568,8 +1564,8 @@ } } else if (qXfer_error.Success()) { // If both qMemoryRegionInfo and qXfer:memory-map:read succeeded, and if - // both regions are the same range, update the result to include the - // flash-memory information that is specific to the qXfer result. + // both regions are the same range, update the result to include the flash- + // memory information that is specific to the qXfer result. if (region_info.GetRange() == qXfer_region_info.GetRange()) { region_info.SetFlash(qXfer_region_info.GetFlash()); region_info.SetBlocksize(qXfer_region_info.GetBlocksize()); @@ -1735,13 +1731,13 @@ Status error; llvm::Triple::ArchType atype = arch.GetMachine(); - // we assume watchpoints will happen after running the relevant opcode - // and we only want to override this behavior if we have explicitly - // received a qHostInfo telling us otherwise + // we assume watchpoints will happen after running the relevant opcode and we + // only want to override this behavior if we have explicitly received a + // qHostInfo telling us otherwise if (m_qHostInfo_is_valid != eLazyBoolYes) { // On targets like MIPS and ppc64le, watchpoint exceptions are always - // generated before the instruction is executed. The connected target - // may not support qHostInfo or qWatchpointSupportInfo packets. + // generated before the instruction is executed. The connected target may + // not support qHostInfo or qWatchpointSupportInfo packets. if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel || atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el || atype == llvm::Triple::ppc64le) @@ -1939,8 +1935,8 @@ process_info.GetArchitecture().SetTriple(triple.c_str()); } else if (name.equals("name")) { StringExtractor extractor(value); - // The process name from ASCII hex bytes since we can't - // control the characters in a process name + // The process name from ASCII hex bytes since we can't control the + // characters in a process name std::string name; extractor.GetHexByteString(name); process_info.GetExecutableFile().SetFile(name, false); @@ -2196,8 +2192,8 @@ } } StringExtractorGDBRemote response; - // Increase timeout as the first qfProcessInfo packet takes a long time - // on Android. The value of 1min was arrived at empirically. + // Increase timeout as the first qfProcessInfo packet takes a long time on + // Android. The value of 1min was arrived at empirically. ScopedTimeout timeout(*this, minutes(1)); if (SendPacketAndWaitForResponse(packet.GetString(), response, false) == PacketResult::Success) { @@ -2231,8 +2227,8 @@ PacketResult::Success) { if (response.IsNormalResponse()) { // Make sure we parsed the right number of characters. The response is - // the hex encoded user name and should make up the entire packet. - // If there are any non-hex ASCII bytes, the length won't match below.. + // the hex encoded user name and should make up the entire packet. If + // there are any non-hex ASCII bytes, the length won't match below.. if (response.GetHexByteString(name) * 2 == response.GetStringRef().size()) return true; @@ -2258,8 +2254,8 @@ PacketResult::Success) { if (response.IsNormalResponse()) { // Make sure we parsed the right number of characters. The response is - // the hex encoded group name and should make up the entire packet. - // If there are any non-hex ASCII bytes, the length won't match below.. + // the hex encoded group name and should make up the entire packet. If + // there are any non-hex ASCII bytes, the length won't match below.. if (response.GetHexByteString(name) * 2 == response.GetStringRef().size()) return true; @@ -2485,8 +2481,8 @@ // Make the GDB server we launch only accept connections from this host stream.Printf("host:%s;", hostname.c_str()); } else { - // Make the GDB server we launch accept connections from any host since we - // can't figure out the hostname + // Make the GDB server we launch accept connections from any host since + // we can't figure out the hostname stream.Printf("host:*;"); } } @@ -3275,9 +3271,8 @@ bool GDBRemoteCommunicationClient::RestoreRegisterState(lldb::tid_t tid, uint32_t save_id) { // We use the "m_supports_QSaveRegisterState" variable here because the - // QSaveRegisterState and QRestoreRegisterState packets must both be supported - // in - // order to be useful + // QSaveRegisterState and QRestoreRegisterState packets must both be + // supported in order to be useful if (m_supports_QSaveRegisterState == eLazyBoolNo) return false; @@ -3673,8 +3668,8 @@ // query the target remote for extended information using the qXfer packet // -// example: object='features', annex='target.xml', out= -// return: 'true' on success +// example: object='features', annex='target.xml', out= return: +// 'true' on success // 'false' on failure (err set) bool GDBRemoteCommunicationClient::ReadExtFeature( const lldb_private::ConstString object, @@ -3781,10 +3776,9 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups( lldb_private::Process *process) { - // Set to true once we've resolved a symbol to an address for the remote stub. - // If we get an 'OK' response after this, the remote stub doesn't need any - // more - // symbols and we can stop asking. + // Set to true once we've resolved a symbol to an address for the remote + // stub. If we get an 'OK' response after this, the remote stub doesn't need + // any more symbols and we can stop asking. bool symbol_response_provided = false; // Is this the initial qSymbol:: packet? @@ -3809,8 +3803,8 @@ first_qsymbol_query = false; if (response.IsUnsupportedResponse()) { - // qSymbol is not supported by the current GDB server we are connected - // to + // qSymbol is not supported by the current GDB server we are + // connected to m_supports_qSymbol = false; return; } else { @@ -3875,10 +3869,8 @@ } } // This is the normal path where our symbol lookup was successful - // and we want - // to send a packet with the new symbol value and see if another - // lookup needs to be - // done. + // and we want to send a packet with the new symbol value and see + // if another lookup needs to be done. // Change "packet" to contain the requested symbol value and name packet.Clear(); @@ -3913,8 +3905,7 @@ StructuredData::Array * GDBRemoteCommunicationClient::GetSupportedStructuredDataPlugins() { if (!m_supported_async_json_packets_is_valid) { - // Query the server for the array of supported asynchronous JSON - // packets. + // Query the server for the array of supported asynchronous JSON packets. m_supported_async_json_packets_is_valid = true; Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); @@ -3928,8 +3919,8 @@ StructuredData::ParseJSON(response.GetStringRef()); if (m_supported_async_json_packets_sp && !m_supported_async_json_packets_sp->GetAsArray()) { - // We were returned something other than a JSON array. This - // is invalid. Clear it out. + // We were returned something other than a JSON array. This is + // invalid. Clear it out. if (log) log->Printf("GDBRemoteCommunicationClient::%s(): " "QSupportedAsyncJSONPackets returned invalid " @@ -3987,8 +3978,7 @@ return error; } - // Build command: Configure{type_name}: serialized config - // data. + // Build command: Configure{type_name}: serialized config data. StreamGDBRemote stream; stream.PutCString("QConfigure"); stream.PutCString(type_name.AsCString()); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -299,9 +299,9 @@ #if defined(__APPLE__) #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) - // For iOS devices, we are connected through a USB Mux so we never pretend - // to actually have a hostname as far as the remote lldb that is connecting - // to this lldb-platform is concerned + // For iOS devices, we are connected through a USB Mux so we never pretend to + // actually have a hostname as far as the remote lldb that is connecting to + // this lldb-platform is concerned response.PutCString("hostname:"); response.PutCStringAsRawHex8("127.0.0.1"); response.PutChar(';'); @@ -419,8 +419,8 @@ } if (Host::FindProcesses(match_info, m_proc_infos)) { - // We found something, return the first item by calling the get - // subsequent process info packet handler... + // We found something, return the first item by calling the get subsequent + // process info packet handler... return Handle_qsProcessInfo(packet); } return SendErrorResponse(3); @@ -984,11 +984,11 @@ GDBRemoteCommunication::PacketResult GDBRemoteCommunicationServerCommon::Handle_A(StringExtractorGDBRemote &packet) { - // The 'A' packet is the most over designed packet ever here with - // redundant argument indexes, redundant argument lengths and needed hex - // encoded argument string values. Really all that is needed is a comma - // separated hex encoded argument value list, but we will stay true to the - // documented version of the 'A' packet here... + // The 'A' packet is the most over designed packet ever here with redundant + // argument indexes, redundant argument lengths and needed hex encoded + // argument string values. Really all that is needed is a comma separated hex + // encoded argument value list, but we will stay true to the documented + // version of the 'A' packet here... Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); int actual_arg_index = 0; @@ -996,8 +996,8 @@ packet.SetFilePos(1); // Skip the 'A' bool success = true; while (success && packet.GetBytesLeft() > 0) { - // Decode the decimal argument string length. This length is the - // number of hex nibbles in the argument string value. + // Decode the decimal argument string length. This length is the number of + // hex nibbles in the argument string value. const uint32_t arg_len = packet.GetU32(UINT32_MAX); if (arg_len == UINT32_MAX) success = false; @@ -1006,8 +1006,8 @@ if (packet.GetChar() != ',') success = false; else { - // Decode the argument index. We ignore this really because - // who would really send down the arguments in a random order??? + // Decode the argument index. We ignore this really because who would + // really send down the arguments in a random order??? const uint32_t arg_idx = packet.GetU32(UINT32_MAX); if (arg_idx == UINT32_MAX) success = false; @@ -1016,9 +1016,9 @@ if (packet.GetChar() != ',') success = false; else { - // Decode the argument string value from hex bytes - // back into a UTF8 string and make sure the length - // matches the one supplied in the packet + // Decode the argument string value from hex bytes back into a UTF8 + // string and make sure the length matches the one supplied in the + // packet std::string arg; if (packet.GetHexByteStringFixedLength(arg, arg_len) != (arg_len / 2)) @@ -1257,8 +1257,8 @@ // Nothing. break; } - // In case of MIPS64, pointer size is depend on ELF ABI - // For N32 the pointer size is 4 and for N64 it is 8 + // In case of MIPS64, pointer size is depend on ELF ABI For N32 the pointer + // size is 4 and for N64 it is 8 std::string abi = proc_arch.GetTargetABI(); if (!abi.empty()) response.Printf("elf_abi:%s;", abi.c_str()); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -236,16 +236,15 @@ m_debugged_process_up = std::move(*process_or); } - // Handle mirroring of inferior stdout/stderr over the gdb-remote protocol - // as needed. - // llgs local-process debugging may specify PTY paths, which will make these - // file actions non-null - // process launch -i/e/o will also make these file actions non-null - // nullptr means that the traffic is expected to flow over gdb-remote protocol + // Handle mirroring of inferior stdout/stderr over the gdb-remote protocol as + // needed. llgs local-process debugging may specify PTY paths, which will + // make these file actions non-null process launch -i/e/o will also make + // these file actions non-null nullptr means that the traffic is expected to + // flow over gdb-remote protocol if (should_forward_stdio) { // nullptr means it's not redirected to file or pty (in case of LLGS local) - // at least one of stdio will be transferred pty<->gdb-remote - // we need to give the pty master handle to this object to read and/or write + // at least one of stdio will be transferred pty<->gdb-remote we need to + // give the pty master handle to this object to read and/or write LLDB_LOG(log, "pid = {0}: setting up stdout/stderr redirection via $O " "gdb-remote commands", @@ -410,8 +409,8 @@ JSONObject::SP register_object_sp = std::make_shared(); #ifdef LLDB_JTHREADSINFO_FULL_REGISTER_SET - // Expedite all registers in the first register set (i.e. should be GPRs) that - // are not contained in other registers. + // Expedite all registers in the first register set (i.e. should be GPRs) + // that are not contained in other registers. const RegisterSet *reg_set_p = reg_ctx_sp->GetRegisterSet(0); if (!reg_set_p) return nullptr; @@ -420,8 +419,7 @@ uint32_t reg_num = *reg_num_p; #else // Expedite only a couple of registers until we figure out why sending - // registers is - // expensive. + // registers is expensive. static const uint32_t k_expedited_registers[] = { LLDB_REGNUM_GENERIC_PC, LLDB_REGNUM_GENERIC_SP, LLDB_REGNUM_GENERIC_FP, LLDB_REGNUM_GENERIC_RA, LLDB_INVALID_REGNUM}; @@ -595,8 +593,7 @@ return SendErrorResponse(52); // FIXME implement register handling for exec'd inferiors. - // if (tid_stop_info.reason == eStopReasonExec) - // { + // if (tid_stop_info.reason == eStopReasonExec) { // const bool force = true; // InitializeRegisters(force); // } @@ -633,14 +630,14 @@ response.PutChar(';'); } - // If a 'QListThreadsInStopReply' was sent to enable this feature, we - // will send all thread IDs back in the "threads" key whose value is - // a list of hex thread IDs separated by commas: + // If a 'QListThreadsInStopReply' was sent to enable this feature, we will + // send all thread IDs back in the "threads" key whose value is a list of hex + // thread IDs separated by commas: // "threads:10a,10b,10c;" - // This will save the debugger from having to send a pair of qfThreadInfo - // and qsThreadInfo packets, but it also might take a lot of room in the - // stop reply packet, so it must be enabled only on systems where there - // are no limits on packet lengths. + // This will save the debugger from having to send a pair of qfThreadInfo and + // qsThreadInfo packets, but it also might take a lot of room in the stop + // reply packet, so it must be enabled only on systems where there are no + // limits on packet lengths. if (m_list_threads_in_stop_reply) { response.PutCString("threads:"); @@ -655,12 +652,11 @@ } response.PutChar(';'); - // Include JSON info that describes the stop reason for any threads - // that actually have stop reasons. We use the new "jstopinfo" key - // whose values is hex ascii JSON that contains the thread IDs - // thread stop info only for threads that have stop reasons. Only send - // this if we have more than one thread otherwise this packet has all - // the info it needs. + // Include JSON info that describes the stop reason for any threads that + // actually have stop reasons. We use the new "jstopinfo" key whose values + // is hex ascii JSON that contains the thread IDs thread stop info only for + // threads that have stop reasons. Only send this if we have more than one + // thread otherwise this packet has all the info it needs. if (thread_index > 0) { const bool threads_with_valid_stop_info_only = true; JSONArray::SP threads_info_sp = GetJSONThreadsInfo( @@ -806,8 +802,8 @@ __FUNCTION__, process->GetID()); } - // Close the pipe to the inferior terminal i/o if we launched it - // and set one up. + // Close the pipe to the inferior terminal i/o if we launched it and set one + // up. MaybeCloseInferiorTerminalConnection(); // We are ready to exit the debug monitor. @@ -823,8 +819,7 @@ if (log) log->Printf("GDBRemoteCommunicationServerLLGS::%s called", __FUNCTION__); - // Send the stop reason unless this is the stop after the - // launch or attach. + // Send the stop reason unless this is the stop after the launch or attach. switch (m_inferior_prev_state) { case eStateLaunching: case eStateAttaching: @@ -859,13 +854,11 @@ break; case StateType::eStateStopped: - // Make sure we get all of the pending stdout/stderr from the inferior - // and send it to the lldb host before we send the state change - // notification + // Make sure we get all of the pending stdout/stderr from the inferior and + // send it to the lldb host before we send the state change notification SendProcessOutput(); // Then stop the forwarding, so that any late output (see llvm.org/pr25652) - // does not - // interfere with our protocol. + // does not interfere with our protocol. StopSTDIOForwarding(); HandleInferiorState_Stopped(process); break; @@ -1287,8 +1280,8 @@ (m_debugged_process_up->GetID() == LLDB_INVALID_PROCESS_ID)) return SendErrorResponse(68); - // Make sure we set the current thread so g and p packets return - // the data the gdb will expect. + // Make sure we set the current thread so g and p packets return the data the + // gdb will expect. lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID(); SetCurrentThreadID(tid); @@ -1397,10 +1390,9 @@ Status error; // We have two branches: what to do if a continue thread is specified (in - // which case we target - // sending the signal to that thread), or when we don't have a continue thread - // set (in which - // case we send a signal to the process). + // which case we target sending the signal to that thread), or when we don't + // have a continue thread set (in which case we send a signal to the + // process). // TODO discuss with Greg Clayton, make sure this makes sense. @@ -1639,8 +1631,8 @@ case eStateStopped: case eStateCrashed: { lldb::tid_t tid = m_debugged_process_up->GetCurrentThreadID(); - // Make sure we set the current thread so g and p packets return - // the data the gdb will expect. + // Make sure we set the current thread so g and p packets return the data + // the gdb will expect. SetCurrentThreadID(tid); return SendStopReplyPacketForThread(tid); } @@ -2043,9 +2035,8 @@ return SendErrorResponse(0x47); } - // The dwarf expression are evaluate on host site - // which may cause register size to change - // Hence the reg_size may not be same as reg_info->bytes_size + // The dwarf expression are evaluate on host site which may cause register + // size to change Hence the reg_size may not be same as reg_info->bytes_size if ((reg_size != reg_info->byte_size) && !(reg_info->dynamic_size_dwarf_expr_bytes)) { return SendIllFormedResponse(packet, "P packet register size is incorrect"); @@ -2376,10 +2367,9 @@ Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS)); // Currently only the NativeProcessProtocol knows if it can handle a - // qMemoryRegionInfoSupported - // request, but we're not guaranteed to be attached to a process. For now - // we'll assume the - // client only asks this when a process is being debugged. + // qMemoryRegionInfoSupported request, but we're not guaranteed to be + // attached to a process. For now we'll assume the client only asks this + // when a process is being debugged. // Ensure we have a process running; otherwise, we can't figure this out // since we won't have a NativeProcessProtocol. @@ -2670,8 +2660,7 @@ } // We first try to use a continue thread id. If any one or any all set, use - // the current thread. - // Bail out if we don't have a thread id. + // the current thread. Bail out if we don't have a thread id. lldb::tid_t tid = GetContinueThreadID(); if (tid == 0 || tid == LLDB_INVALID_THREAD_ID) tid = GetCurrentThreadID(); @@ -3093,8 +3082,8 @@ std::vector signals; packet.SetFilePos(strlen("QPassSignals:")); - // Read sequence of hex signal numbers divided by a semicolon and - // optionally spaces. + // Read sequence of hex signal numbers divided by a semicolon and optionally + // spaces. while (packet.GetBytesLeft() > 0) { int signal = packet.GetS32(-1, 16); if (signal < 0) @@ -3154,8 +3143,7 @@ return nullptr; // If the client hasn't asked for thread suffix support, there will not be a - // thread suffix. - // Use the current thread in that case. + // thread suffix. Use the current thread in that case. if (!m_thread_suffix_supported) { const lldb::tid_t current_tid = GetCurrentThreadID(); if (current_tid == LLDB_INVALID_THREAD_ID) @@ -3201,9 +3189,9 @@ lldb::tid_t GDBRemoteCommunicationServerLLGS::GetCurrentThreadID() const { if (m_current_tid == 0 || m_current_tid == LLDB_INVALID_THREAD_ID) { - // Use whatever the debug process says is the current thread id - // since the protocol either didn't specify or specified we want - // any/all threads marked as the current thread. + // Use whatever the debug process says is the current thread id since the + // protocol either didn't specify or specified we want any/all threads + // marked as the current thread. if (!m_debugged_process_up) return LLDB_INVALID_THREAD_ID; return m_debugged_process_up->GetCurrentThreadID(); Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp @@ -102,11 +102,11 @@ if (port == UINT16_MAX) port = GetNextAvailablePort(); - // Spawn a new thread to accept the port that gets bound after - // binding to port 0 (zero). + // Spawn a new thread to accept the port that gets bound after binding to + // port 0 (zero). - // ignore the hostname send from the remote end, just use the ip address - // that we're currently communicating with as the hostname + // ignore the hostname send from the remote end, just use the ip address that + // we're currently communicating with as the hostname // Spawn a debugserver and try to get the port it listens to. ProcessLaunchInfo debugserver_launch_info; @@ -117,8 +117,8 @@ if (log) log->Printf("Launching debugserver with: %s:%u...", hostname.c_str(), port); - // Do not run in a new session so that it can not linger after the - // platform closes. + // Do not run in a new session so that it can not linger after the platform + // closes. debugserver_launch_info.SetLaunchInSeparateProcessGroup(false); debugserver_launch_info.SetMonitorProcessCallback( std::bind(&GDBRemoteCommunicationServerPlatform::DebugserverProcessReaped, @@ -171,8 +171,8 @@ #ifdef _WIN32 return SendErrorResponse(9); #else - // Spawn a local debugserver as a platform so we can then attach or launch - // a process... + // Spawn a local debugserver as a platform so we can then attach or launch a + // process... Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) @@ -260,8 +260,7 @@ lldb::pid_t pid = packet.GetU64(LLDB_INVALID_PROCESS_ID); - // verify that we know anything about this pid. - // Scope for locker + // verify that we know anything about this pid. Scope for locker { std::lock_guard guard(m_spawned_pids_mutex); if (m_spawned_pids.find(pid) == m_spawned_pids.end()) { @@ -307,8 +306,8 @@ return true; } - // the launched process still lives. Now try killing it again, - // this time with an unblockable signal. + // the launched process still lives. Now try killing it again, this time + // with an unblockable signal. Host::Kill(pid, SIGKILL); for (size_t i = 0; i < 10; ++i) { @@ -322,8 +321,7 @@ usleep(10000); } - // check one more time after the final usleep - // Scope for locker + // check one more time after the final usleep Scope for locker { std::lock_guard guard(m_spawned_pids_mutex); if (m_spawned_pids.find(pid) == m_spawned_pids.end()) @@ -390,14 +388,13 @@ StreamString response; response.Printf("QC%" PRIx64, pid); - // If we launch a process and this GDB server is acting as a platform, - // then we need to clear the process launch state so we can start - // launching another process. In order to launch a process a bunch or - // packets need to be sent: environment packets, working directory, - // disable ASLR, and many more settings. When we launch a process we - // then need to know when to clear this information. Currently we are - // selecting the 'qC' packet as that packet which seems to make the most - // sense. + // If we launch a process and this GDB server is acting as a platform, then + // we need to clear the process launch state so we can start launching + // another process. In order to launch a process a bunch or packets need to + // be sent: environment packets, working directory, disable ASLR, and many + // more settings. When we launch a process we then need to know when to clear + // this information. Currently we are selecting the 'qC' packet as that + // packet which seems to make the most sense. if (pid != LLDB_INVALID_PROCESS_ID) { m_process_launch_info.Clear(); } @@ -446,9 +443,8 @@ return Status("%s: no process command line specified to launch", __FUNCTION__); - // specify the process monitor if not already set. This should - // generally be what happens since we need to reap started - // processes. + // specify the process monitor if not already set. This should generally be + // what happens since we need to reap started processes. if (!m_process_launch_info.GetMonitorProcessCallback()) m_process_launch_info.SetMonitorProcessCallback( std::bind( @@ -467,8 +463,8 @@ m_process_launch_info.GetArguments().GetArgumentAtIndex(0), m_process_launch_info.GetProcessID()); - // add to list of spawned processes. On an lldb-gdbserver, we - // would expect there to be only one. + // add to list of spawned processes. On an lldb-gdbserver, we would expect + // there to be only one. const auto pid = m_process_launch_info.GetProcessID(); if (pid != LLDB_INVALID_PROCESS_ID) { // add to spawned pids Index: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -39,9 +39,9 @@ GDBRemoteDynamicRegisterInfo ®_info, bool read_all_at_once) : RegisterContext(thread, concrete_frame_idx), m_reg_info(reg_info), m_reg_valid(), m_reg_data(), m_read_all_at_once(read_all_at_once) { - // Resize our vector of bools to contain one bool for every register. - // We will use these boolean values to know when a register value - // is valid in m_reg_data. + // Resize our vector of bools to contain one bool for every register. We will + // use these boolean values to know when a register value is valid in + // m_reg_data. m_reg_valid.resize(reg_info.GetNumRegisters()); // Make a heap based buffer that is big enough to store all registers @@ -119,8 +119,8 @@ if (success) { SetRegisterIsValid(reg, true); } else if (data.size() > 0) { - // Only set register is valid to false if we copied some bytes, else - // leave it as it was. + // Only set register is valid to false if we copied some bytes, else leave + // it as it was. SetRegisterIsValid(reg, false); } return success; @@ -133,11 +133,9 @@ return false; // Early in process startup, we can get a thread that has an invalid byte - // order - // because the process hasn't been completely set up yet (see the ctor where - // the - // byte order is setfrom the process). If that's the case, we can't set the - // value here. + // order because the process hasn't been completely set up yet (see the ctor + // where the byte order is setfrom the process). If that's the case, we + // can't set the value here. if (m_reg_data.GetByteOrder() == eByteOrderInvalid) { return false; } @@ -149,8 +147,7 @@ DataExtractor data(buffer_sp, endian::InlHostByteOrder(), sizeof(void *)); // If our register context and our register info disagree, which should never - // happen, don't - // overwrite past the end of the buffer. + // happen, don't overwrite past the end of the buffer. if (m_reg_data.GetByteSize() < reg_info->byte_offset + reg_info->byte_size) return false; @@ -219,8 +216,7 @@ } if (reg_info->value_regs) { // Process this composite register request by delegating to the - // constituent - // primordial registers. + // constituent primordial registers. // Index of the primordial register. bool success = true; @@ -228,8 +224,8 @@ const uint32_t prim_reg = reg_info->value_regs[idx]; if (prim_reg == LLDB_INVALID_REGNUM) break; - // We have a valid primordial register as our constituent. - // Grab the corresponding register info. + // We have a valid primordial register as our constituent. Grab the + // corresponding register info. const RegisterInfo *prim_reg_info = GetRegisterInfoAtIndex(prim_reg); if (prim_reg_info == NULL) success = false; @@ -242,8 +238,7 @@ if (success) { // If we reach this point, all primordial register requests have - // succeeded. - // Validate this composite register. + // succeeded. Validate this composite register. SetRegisterIsValid(reg_info, true); } } else { @@ -262,16 +257,14 @@ reg_info->byte_offset + reg_info->byte_size); #endif // If our register context and our register info disagree, which should - // never happen, don't - // read past the end of the buffer. + // never happen, don't read past the end of the buffer. if (m_reg_data.GetByteSize() < reg_info->byte_offset + reg_info->byte_size) return false; - // If we aren't extracting into our own buffer (which - // only happens when this function is called from - // ReadRegisterValue(uint32_t, Scalar&)) then - // we transfer bytes from our buffer into the data - // buffer that was passed in + // If we aren't extracting into our own buffer (which only happens when + // this function is called from ReadRegisterValue(uint32_t, Scalar&)) then + // we transfer bytes from our buffer into the data buffer that was passed + // in data.SetByteOrder(m_reg_data.GetByteOrder()); data.SetData(m_reg_data, reg_info->byte_offset, reg_info->byte_size); @@ -321,8 +314,7 @@ #endif // If our register context and our register info disagree, which should never - // happen, don't - // overwrite past the end of the buffer. + // happen, don't overwrite past the end of the buffer. if (m_reg_data.GetByteSize() < reg_info->byte_offset + reg_info->byte_size) return false; @@ -358,12 +350,10 @@ bool success = true; if (reg_info->value_regs) { - // This register is part of another register. In this case we read the - // actual - // register data for any "value_regs", and once all that data is read, - // we will - // have enough data in our register context bytes for the value of - // this register + // This register is part of another register. In this case we read + // the actual register data for any "value_regs", and once all that + // data is read, we will have enough data in our register context + // bytes for the value of this register // Invalidate this composite register first. @@ -371,8 +361,8 @@ const uint32_t reg = reg_info->value_regs[idx]; if (reg == LLDB_INVALID_REGNUM) break; - // We have a valid primordial register as our constituent. - // Grab the corresponding register info. + // We have a valid primordial register as our constituent. Grab the + // corresponding register info. const RegisterInfo *value_reg_info = GetRegisterInfoAtIndex(reg); if (value_reg_info == NULL) success = false; @@ -385,8 +375,7 @@ } // Check if writing this register will invalidate any other register - // values? - // If so, invalidate them + // values? If so, invalidate them if (reg_info->invalidate_regs) { for (uint32_t idx = 0, reg = reg_info->invalidate_regs[0]; reg != LLDB_INVALID_REGNUM; @@ -548,26 +537,22 @@ return true; uint32_t num_restored = 0; - // We need to manually go through all of the registers and - // restore them manually + // We need to manually go through all of the registers and restore them + // manually DataExtractor restore_data(data_sp, m_reg_data.GetByteOrder(), m_reg_data.GetAddressByteSize()); const RegisterInfo *reg_info; - // The g packet contents may either include the slice registers (registers - // defined in - // terms of other registers, e.g. eax is a subset of rax) or not. The - // slice registers - // should NOT be in the g packet, but some implementations may incorrectly - // include them. + // The g packet contents may either include the slice registers + // (registers defined in terms of other registers, e.g. eax is a subset + // of rax) or not. The slice registers should NOT be in the g packet, + // but some implementations may incorrectly include them. // // If the slice registers are included in the packet, we must step over - // the slice registers - // when parsing the packet -- relying on the RegisterInfo byte_offset - // field would be incorrect. - // If the slice registers are not included, then using the byte_offset - // values into the + // the slice registers when parsing the packet -- relying on the + // RegisterInfo byte_offset field would be incorrect. If the slice + // registers are not included, then using the byte_offset values into the // data buffer is the best way to find individual register values. uint64_t size_including_slice_registers = 0; @@ -591,21 +576,17 @@ } else if (size_not_including_slice_registers == restore_data.GetByteSize()) { // The size of the packet is the same as concatenating all of the - // registers sequentially, - // skipping the slice registers + // registers sequentially, skipping the slice registers use_byte_offset_into_buffer = true; } else if (size_including_slice_registers == restore_data.GetByteSize()) { // The slice registers are present in the packet (when they shouldn't - // be). - // Don't try to use the RegisterInfo byte_offset into the restore_data, - // it will - // point to the wrong place. + // be). Don't try to use the RegisterInfo byte_offset into the + // restore_data, it will point to the wrong place. use_byte_offset_into_buffer = false; } else { // None of our expected sizes match the actual g packet data we're - // looking at. - // The most conservative approach here is to use the running total byte - // offset. + // looking at. The most conservative approach here is to use the + // running total byte offset. use_byte_offset_into_buffer = false; } @@ -664,11 +645,9 @@ if (reg_info->value_regs) // skip registers that are slices of real // registers continue; - // Skip the fpsr and fpcr floating point status/control register writing - // to - // work around a bug in an older version of debugserver that would lead - // to - // register context corruption when writing fpsr/fpcr. + // Skip the fpsr and fpcr floating point status/control register + // writing to work around a bug in an older version of debugserver that + // would lead to register context corruption when writing fpsr/fpcr. if (arm64_debugserver && (strcmp(reg_info->name, "fpsr") == 0 || strcmp(reg_info->name, "fpcr") == 0)) { continue; @@ -752,8 +731,8 @@ static uint32_t g_q14_regs[] = {71, 72, LLDB_INVALID_REGNUM}; // (d28, d29) static uint32_t g_q15_regs[] = {73, 74, LLDB_INVALID_REGNUM}; // (d30, d31) - // This is our array of composite registers, with each element coming from the - // above register mappings. + // This is our array of composite registers, with each element coming from + // the above register mappings. static uint32_t *g_composites[] = { g_d0_regs, g_d1_regs, g_d2_regs, g_d3_regs, g_d4_regs, g_d5_regs, g_d6_regs, g_d7_regs, g_d8_regs, g_d9_regs, g_d10_regs, g_d11_regs, @@ -884,21 +863,17 @@ if (from_scratch) { // Calculate the offsets of the registers // Note that the layout of the "composite" registers (d0-d15 and q0-q15) - // which comes after the - // "primordial" registers is important. This enables us to calculate the - // offset of the composite - // register by using the offset of its first primordial register. For - // example, to calculate the - // offset of q0, use s0's offset. + // which comes after the "primordial" registers is important. This enables + // us to calculate the offset of the composite register by using the offset + // of its first primordial register. For example, to calculate the offset + // of q0, use s0's offset. if (g_register_infos[2].byte_offset == 0) { uint32_t byte_offset = 0; for (i = 0; i < num_registers; ++i) { // For primordial registers, increment the byte_offset by the byte_size - // to arrive at the - // byte_offset for the next register. Otherwise, we have a composite - // register whose - // offset can be calculated by consulting the offset of its first - // primordial register. + // to arrive at the byte_offset for the next register. Otherwise, we + // have a composite register whose offset can be calculated by + // consulting the offset of its first primordial register. if (!g_register_infos[i].value_regs) { g_register_infos[i].byte_offset = byte_offset; byte_offset += g_register_infos[i].byte_size; @@ -933,8 +908,8 @@ RegisterInfo *g_comp_register_infos = g_register_infos + num_common_regs; // First we need to validate that all registers that we already have match - // the non composite regs. - // If so, then we can add the registers, else we need to bail + // the non composite regs. If so, then we can add the registers, else we + // need to bail bool match = true; if (num_dynamic_regs == num_common_regs) { for (i = 0; match && i < num_dynamic_regs; ++i) { @@ -970,9 +945,8 @@ // Find a matching primordial register info entry. if (reg_info && reg_info->name && ::strcasecmp(reg_info->name, reg_name) == 0) { - // The name matches the existing primordial entry. - // Find and assign the offset, and then add this composite - // register entry. + // The name matches the existing primordial entry. Find and + // assign the offset, and then add this composite register entry. g_comp_register_infos[i].byte_offset = reg_info->byte_offset; name.SetCString(g_comp_register_infos[i].name); AddRegister(g_comp_register_infos[i], name, alt_name, Index: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -94,11 +94,11 @@ namespace lldb { // Provide a function that can easily dump the packet history if we know a -// ProcessGDBRemote * value (which we can get from logs or from debugging). -// We need the function in the lldb namespace so it makes it into the final +// ProcessGDBRemote * value (which we can get from logs or from debugging). We +// need the function in the lldb namespace so it makes it into the final // executable since the LLDB shared library only exports stuff in the lldb -// namespace. This allows you to attach with a debugger and call this -// function and get the packet history dumped to a file. +// namespace. This allows you to attach with a debugger and call this function +// and get the packet history dumped to a file. void DumpProcessGDBRemotePacketHistory(void *p, const char *path) { StreamFile strm; Status error(strm.GetFile().Open(path, File::eOpenOptionWrite | @@ -161,8 +161,8 @@ } // anonymous namespace end // TODO Randomly assigning a port is unsafe. We should get an unused -// ephemeral port from the kernel and make sure we reserve it before passing -// it to debugserver. +// ephemeral port from the kernel and make sure we reserve it before passing it +// to debugserver. #if defined(__APPLE__) #define LOW_PORT (IPPORT_RESERVED) @@ -236,8 +236,8 @@ } return exe_module->GetFileSpec().Exists(); } - // However, if there is no executable module, we return true since we might be - // preparing to attach. + // However, if there is no executable module, we return true since we might + // be preparing to attach. return true; } @@ -303,17 +303,16 @@ ProcessGDBRemote::~ProcessGDBRemote() { // m_mach_process.UnregisterNotificationCallbacks (this); Clear(); - // We need to call finalize on the process before destroying ourselves - // to make sure all of the broadcaster cleanup goes as planned. If we - // destruct this class, then Process::~Process() might have problems - // trying to fully destroy the broadcaster. + // We need to call finalize on the process before destroying ourselves to + // make sure all of the broadcaster cleanup goes as planned. If we destruct + // this class, then Process::~Process() might have problems trying to fully + // destroy the broadcaster. Finalize(); - // The general Finalize is going to try to destroy the process and that SHOULD - // shut down the async thread. However, if we don't kill it it will get - // stranded and - // its connection will go away so when it wakes up it will crash. So kill it - // for sure here. + // The general Finalize is going to try to destroy the process and that + // SHOULD shut down the async thread. However, if we don't kill it it will + // get stranded and its connection will go away so when it wakes up it will + // crash. So kill it for sure here. StopAsyncThread(); KillDebugserverProcess(); } @@ -372,8 +371,7 @@ } // If the remote stub didn't give us eh_frame or DWARF register numbers for a -// register, -// see if the ABI can provide them. +// register, see if the ABI can provide them. // DWARF and eh_frame register numbers are defined as a part of the ABI. static void AugmentRegisterInfoViaABI(RegisterInfo ®_info, ConstString reg_name, ABISP abi_sp) { @@ -426,9 +424,9 @@ m_register_info.Clear(); - // Check if qHostInfo specified a specific packet timeout for this connection. - // If so then lets update our setting so the user knows what the timeout is - // and can see it. + // Check if qHostInfo specified a specific packet timeout for this + // connection. If so then lets update our setting so the user knows what the + // timeout is and can see it. const auto host_packet_timeout = m_gdb_comm.GetHostDefaultPacketTimeout(); if (host_packet_timeout > std::chrono::seconds(0)) { GetGlobalPluginProperties()->SetPacketTimeout(host_packet_timeout.count()); @@ -600,10 +598,8 @@ } // We have to make a temporary ABI here, and not use the GetABI because - // this code - // gets called in DidAttach, when the target architecture (and - // consequently the ABI we'll get from - // the process) may be wrong. + // this code gets called in DidAttach, when the target architecture + // (and consequently the ABI we'll get from the process) may be wrong. ABISP abi_to_use = ABI::FindPlugin(shared_from_this(), arch_to_use); AugmentRegisterInfoViaABI(reg_info, reg_name, abi_to_use); @@ -624,9 +620,9 @@ // We didn't get anything if the accumulated reg_num is zero. See if we are // debugging ARM and fill with a hard coded register set until we can get an - // updated debugserver down on the devices. - // On the other hand, if the accumulated reg_num is positive, see if we can - // add composite registers to the existing primordial ones. + // updated debugserver down on the devices. On the other hand, if the + // accumulated reg_num is positive, see if we can add composite registers to + // the existing primordial ones. bool from_scratch = (m_register_info.GetNumRegisters() == 0); if (!target_arch.IsValid()) { @@ -673,9 +669,8 @@ lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID(); if (pid == LLDB_INVALID_PROCESS_ID) { - // We don't have a valid process ID, so note that we are connected - // and could now request to launch or attach, or get remote process - // listings... + // We don't have a valid process ID, so note that we are connected and + // could now request to launch or attach, or get remote process listings... SetPrivateState(eStateConnected); } else { // We have a valid process @@ -725,7 +720,8 @@ if (error.Success() && !GetTarget().GetArchitecture().IsValid() && m_gdb_comm.GetHostArchitecture().IsValid()) { - // Prefer the *process'* architecture over that of the *host*, if available. + // Prefer the *process'* architecture over that of the *host*, if + // available. if (m_gdb_comm.GetProcessArchitecture().IsValid()) GetTarget().SetArchitecture(m_gdb_comm.GetProcessArchitecture()); else @@ -804,8 +800,8 @@ const bool disable_stdio = (launch_flags & eLaunchFlagDisableSTDIO) != 0; if (stdin_file_spec || disable_stdio) { - // the inferior will be reading stdin from the specified file - // or stdio is completely disabled + // the inferior will be reading stdin from the specified file or stdio is + // completely disabled m_stdin_forward = false; } else { m_stdin_forward = true; @@ -999,16 +995,15 @@ return error; } - // Start the communications read thread so all incoming data can be - // parsed into packets and queued as they arrive. + // Start the communications read thread so all incoming data can be parsed + // into packets and queued as they arrive. if (GetTarget().GetNonStopModeEnabled()) m_gdb_comm.StartReadThread(); - // We always seem to be able to open a connection to a local port - // so we need to make sure we can then send data to it. If we can't - // then we aren't actually connected to anything, so try and do the - // handshake with the remote GDB server and make sure that goes - // alright. + // We always seem to be able to open a connection to a local port so we need + // to make sure we can then send data to it. If we can't then we aren't + // actually connected to anything, so try and do the handshake with the + // remote GDB server and make sure that goes alright. if (!m_gdb_comm.HandshakeWithServer(&error)) { m_gdb_comm.Disconnect(); if (error.Success()) @@ -1050,9 +1045,9 @@ // See if the GDB server supports the qHostInfo information - // See if the GDB server supports the qProcessInfo packet, if so - // prefer that over the Host information as it will be more specific - // to our process. + // See if the GDB server supports the qProcessInfo packet, if so prefer + // that over the Host information as it will be more specific to our + // process. const ArchSpec &remote_process_arch = m_gdb_comm.GetProcessArchitecture(); if (remote_process_arch.IsValid()) { @@ -1097,9 +1092,8 @@ // architectures. // You can have an armv6 executable, and if the host is armv7, then the // system will load the best possible architecture for all shared - // libraries - // it has, so we really need to take the remote host architecture as our - // defacto architecture in this case. + // libraries it has, so we really need to take the remote host + // architecture as our defacto architecture in this case. if ((process_arch.GetMachine() == llvm::Triple::arm || process_arch.GetMachine() == llvm::Triple::thumb) && @@ -1145,14 +1139,14 @@ ? target_arch.GetTriple().getTriple().c_str() : ""); } else { - // The target doesn't have a valid architecture yet, set it from - // the architecture we got from the remote GDB server + // The target doesn't have a valid architecture yet, set it from the + // architecture we got from the remote GDB server GetTarget().SetArchitecture(process_arch); } } - // Find out which StructuredDataPlugins are supported by the - // debug monitor. These plugins transmit data over async $J packets. + // Find out which StructuredDataPlugins are supported by the debug monitor. + // These plugins transmit data over async $J packets. auto supported_packets_array = m_gdb_comm.GetSupportedStructuredDataPlugins(); if (supported_packets_array) @@ -1360,9 +1354,9 @@ continue_packet_error = true; if (continue_packet_error) { - // Either no vCont support, or we tried to use part of the vCont - // packet that wasn't supported by the remote GDB server. - // We need to try and make a simple packet that can do our continue + // Either no vCont support, or we tried to use part of the vCont packet + // that wasn't supported by the remote GDB server. We need to try and + // make a simple packet that can do our continue const size_t num_continue_c_tids = m_continue_c_tids.size(); const size_t num_continue_C_tids = m_continue_C_tids.size(); const size_t num_continue_s_tids = m_continue_s_tids.size(); @@ -1389,11 +1383,10 @@ const int continue_signo = m_continue_C_tids.front().second; // Only one thread is continuing if (num_continue_C_tids > 1) { - // More that one thread with a signal, yet we don't have - // vCont support and we are being asked to resume each - // thread with a signal, we need to make sure they are - // all the same signal, or we can't issue the continue - // accurately with the current support... + // More that one thread with a signal, yet we don't have vCont + // support and we are being asked to resume each thread with a + // signal, we need to make sure they are all the same signal, or we + // can't issue the continue accurately with the current support... if (num_continue_C_tids > 1) { continue_packet_error = false; for (size_t i = 1; i < m_continue_C_tids.size(); ++i) { @@ -1670,9 +1663,8 @@ } } - // Whatever that is left in old_thread_list_copy are not - // present in new_thread_list. Remove non-existent threads from internal id - // table. + // Whatever that is left in old_thread_list_copy are not present in + // new_thread_list. Remove non-existent threads from internal id table. size_t old_num_thread_ids = old_thread_list_copy.GetSize(false); for (size_t i = 0; i < old_num_thread_ids; i++) { ThreadSP old_thread_sp(old_thread_list_copy.GetThreadAtIndex(i, false)); @@ -1733,12 +1725,11 @@ return true; // See if we got thread stop info for any threads valid stop info reasons - // threads - // via the "jstopinfo" packet stop reply packet key/value pair? + // threads via the "jstopinfo" packet stop reply packet key/value pair? if (m_jstopinfo_sp) { // If we have "jstopinfo" then we have stop descriptions for all threads - // that have stop reasons, and if there is no entry for a thread, then - // it has no stop reason. + // that have stop reasons, and if there is no entry for a thread, then it + // has no stop reason. thread->GetRegisterContext()->InvalidateIfNeeded(true); if (!GetThreadStopInfoFromJSON(thread, m_jstopinfo_sp)) { thread->SetStopInfo(StopInfoSP()); @@ -1766,9 +1757,8 @@ if (tid != LLDB_INVALID_THREAD_ID) { // Scope for "locker" below { - // m_thread_list_real does have its own mutex, but we need to - // hold onto the mutex between the call to - // m_thread_list_real.FindThreadByID(...) + // m_thread_list_real does have its own mutex, but we need to hold onto + // the mutex between the call to m_thread_list_real.FindThreadByID(...) // and the m_thread_list_real.AddThread(...) so it doesn't change on us std::lock_guard guard( m_thread_list_real.GetMutex()); @@ -1846,9 +1836,9 @@ ->GetBreakpointSiteList() .FindByAddress(pc); - // If the current pc is a breakpoint site then the StopInfo should - // be set to Breakpoint - // Otherwise, it will be set to Trace. + // If the current pc is a breakpoint site then the StopInfo + // should be set to Breakpoint Otherwise, it will be set to + // Trace. if (bp_site_sp && bp_site_sp->ValidForThisThread(thread_sp.get())) { thread_sp->SetStopInfo( @@ -1865,11 +1855,10 @@ .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, - // we can just report no reason. We don't need to worry about - // stepping over the breakpoint here, that - // will be taken care of when the thread resumes and notices - // that there's a breakpoint under the pc. + // hit, but if it is for another thread, we can just report no + // reason. We don't need to worry about stepping over the + // breakpoint here, that will be taken care of when the thread + // resumes and notices that there's a breakpoint under the pc. handled = true; if (bp_site_sp->ValidForThisThread(thread_sp.get())) { thread_sp->SetStopInfo( @@ -1931,13 +1920,10 @@ pc); // If the current pc is a breakpoint site then the StopInfo should - // be set to Breakpoint - // even though the remote stub did not set it as such. This can - // happen when - // the thread is involuntarily interrupted (e.g. due to stops on - // other - // threads) just as it is about to execute the breakpoint - // instruction. + // be set to Breakpoint even though the remote stub did not set it + // as such. This can happen when the thread is involuntarily + // interrupted (e.g. due to stops on other threads) just as it is + // about to execute the breakpoint instruction. if (bp_site_sp && bp_site_sp->ValidForThisThread(thread_sp.get())) { thread_sp->SetStopInfo( StopInfo::CreateStopReasonWithBreakpointSiteID( @@ -1959,11 +1945,10 @@ if (bp_site_sp) { // If the breakpoint is for this thread, then we'll report the - // hit, but if it is for another thread, - // we can just report no reason. We don't need to worry about - // stepping over the breakpoint here, that - // will be taken care of when the thread resumes and notices - // that there's a breakpoint under the pc. + // hit, but if it is for another thread, we can just report no + // reason. We don't need to worry about stepping over the + // breakpoint here, that will be taken care of when the thread + // resumes and notices that there's a breakpoint under the pc. if (bp_site_sp->ValidForThisThread(thread_sp.get())) { if (m_breakpoint_pc_offset != 0) thread_sp->GetRegisterContext()->SetPC(pc); @@ -1976,8 +1961,7 @@ } } else { // If we were stepping then assume the stop was the result of - // the trace. If we were - // not stepping then report the SIGTRAP. + // the trace. If we were not stepping then report the SIGTRAP. // FIXME: We are still missing the case where we single step // over a trap instruction. if (thread_sp->GetTemporaryResumeState() == eStateStepping) @@ -2172,15 +2156,15 @@ switch (stop_type) { case 'T': case 'S': { - // This is a bit of a hack, but is is required. If we did exec, we - // need to clear our thread lists and also know to rebuild our dynamic - // register info before we lookup and threads and populate the expedited - // register values so we need to know this right away so we can cleanup - // and update our registers. + // This is a bit of a hack, but is is required. If we did exec, we need to + // clear our thread lists and also know to rebuild our dynamic register + // info before we lookup and threads and populate the expedited register + // values so we need to know this right away so we can cleanup and update + // our registers. const uint32_t stop_id = GetStopID(); if (stop_id == 0) { - // Our first stop, make sure we have a process ID, and also make - // sure we know about our registers + // Our first stop, make sure we have a process ID, and also make sure we + // know about our registers if (GetID() == LLDB_INVALID_PROCESS_ID) { lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID(); if (pid != LLDB_INVALID_PROCESS_ID) @@ -2226,8 +2210,7 @@ m_thread_ids.clear(); // A comma separated list of all threads in the current - // process that includes the thread for this stop reply - // packet + // process that includes the thread for this stop reply packet lldb::tid_t tid; while (!value.empty()) { llvm::StringRef tid_str; @@ -2239,8 +2222,7 @@ } else if (key.compare("thread-pcs") == 0) { m_thread_pcs.clear(); // A comma separated list of all threads in the current - // process that includes the thread for this stop reply - // packet + // process that includes the thread for this stop reply packet lldb::addr_t pc; while (!value.empty()) { llvm::StringRef pc_str; @@ -2292,13 +2274,10 @@ desc_extractor.GetHexByteString(description); } else if (key.compare("memory") == 0) { // Expedited memory. GDB servers can choose to send back expedited - // memory - // that can populate the L1 memory cache in the process so that things - // like - // the frame pointer backchain can be expedited. This will help stack - // backtracing be more efficient by not having to send as many memory - // read - // requests down the remote GDB server. + // memory that can populate the L1 memory cache in the process so that + // things like the frame pointer backchain can be expedited. This will + // help stack backtracing be more efficient by not having to send as + // many memory read requests down the remote GDB server. // Key/value pair format: memory:=; // is a number whose base will be interpreted by the prefix: @@ -2350,7 +2329,8 @@ if (tid == LLDB_INVALID_THREAD_ID) { // A thread id may be invalid if the response is old style 'S' packet // which does not provide the - // thread information. So update the thread list and choose the first one. + // thread information. So update the thread list and choose the first + // one. UpdateThreadIDList(); if (!m_thread_ids.empty()) { @@ -2383,9 +2363,9 @@ m_thread_ids.clear(); m_thread_pcs.clear(); - // Set the thread stop info. It might have a "threads" key whose value is - // a list of all thread IDs in the current process, so m_thread_ids might - // get set. + // Set the thread stop info. It might have a "threads" key whose value is a + // list of all thread IDs in the current process, so m_thread_ids might get + // set. // Scope for the lock { @@ -2416,8 +2396,8 @@ m_initial_tid = LLDB_INVALID_THREAD_ID; } - // Let all threads recover from stopping and do any clean up based - // on the previous thread state (if any). + // Let all threads recover from stopping and do any clean up based on the + // previous thread state (if any). m_thread_list_real.RefreshStateAfterStop(); } @@ -2425,8 +2405,8 @@ Status error; if (m_public_state.GetValue() == eStateAttaching) { - // We are being asked to halt during an attach. We need to just close - // our file handle and debugserver will go away, and we can be done... + // We are being asked to halt during an attach. We need to just close our + // file handle and debugserver will go away, and we can be done... m_gdb_comm.Disconnect(); } else caused_stop = m_gdb_comm.Interrupt(); @@ -2469,31 +2449,24 @@ log->Printf("ProcessGDBRemote::DoDestroy()"); // There is a bug in older iOS debugservers where they don't shut down the - // process - // they are debugging properly. If the process is sitting at a breakpoint or - // an exception, - // this can cause problems with restarting. So we check to see if any of our - // threads are stopped - // at a breakpoint, and if so we remove all the breakpoints, resume the - // process, and THEN - // destroy it again. + // process they are debugging properly. If the process is sitting at a + // breakpoint or an exception, this can cause problems with restarting. So + // we check to see if any of our threads are stopped at a breakpoint, and if + // so we remove all the breakpoints, resume the process, and THEN destroy it + // again. // // Note, we don't have a good way to test the version of debugserver, but I - // happen to know that - // the set of all the iOS debugservers which don't support - // GetThreadSuffixSupported() and that of - // the debugservers with this bug are equal. There really should be a better - // way to test this! + // happen to know that the set of all the iOS debugservers which don't + // support GetThreadSuffixSupported() and that of the debugservers with this + // bug are equal. There really should be a better way to test this! // // We also use m_destroy_tried_resuming to make sure we only do this once, if - // we resume and then halt and - // get called here to destroy again and we're still at a breakpoint or - // exception, then we should - // just do the straight-forward kill. + // we resume and then halt and get called here to destroy again and we're + // still at a breakpoint or exception, then we should just do the straight- + // forward kill. // // And of course, if we weren't able to stop the process by the time we get - // here, it isn't - // necessary (or helpful) to do any of this. + // here, it isn't necessary (or helpful) to do any of this. if (!m_gdb_comm.GetThreadSuffixSupported() && m_public_state.GetValue() != eStateRunning) { @@ -2508,9 +2481,8 @@ "destroy once already, not doing it again."); } else { // At present, the plans are discarded and the breakpoints disabled - // Process::Destroy, - // but we really need it to happen here and it doesn't matter if we do - // it twice. + // Process::Destroy, but we really need it to happen here and it + // doesn't matter if we do it twice. m_thread_list.DiscardThreadPlans(); DisableAllBreakpointSites(); @@ -2547,12 +2519,11 @@ m_destroy_tried_resuming = true; // If we are going to run again before killing, it would be good to - // suspend all the threads - // before resuming so they won't get into more trouble. Sadly, for - // the threads stopped with - // the breakpoint or exception, the exception doesn't get cleared if - // it is suspended, so we do - // have to run the risk of letting those threads proceed a bit. + // suspend all the threads before resuming so they won't get into + // more trouble. Sadly, for the threads stopped with the breakpoint + // or exception, the exception doesn't get cleared if it is + // suspended, so we do have to run the risk of letting those threads + // proceed a bit. { std::lock_guard guard(threads.GetMutex()); @@ -2599,17 +2570,14 @@ if (packet_cmd == 'W' || packet_cmd == 'X') { #if defined(__APPLE__) // For Native processes on Mac OS X, we launch through the Host - // Platform, then hand the process off - // to debugserver, which becomes the parent process through - // "PT_ATTACH". Then when we go to kill - // the process on Mac OS X we call ptrace(PT_KILL) to kill it, then we - // call waitpid which returns - // with no error and the correct status. But amusingly enough that - // doesn't seem to actually reap + // Platform, then hand the process off to debugserver, which becomes + // the parent process through "PT_ATTACH". Then when we go to kill + // the process on Mac OS X we call ptrace(PT_KILL) to kill it, then + // we call waitpid which returns with no error and the correct + // status. But amusingly enough that doesn't seem to actually reap // the process, but instead it is left around as a Zombie. Probably - // the kernel is in the process of - // switching ownership back to lldb which was the original parent, and - // gets confused in the handoff. + // the kernel is in the process of switching ownership back to lldb + // which was the original parent, and gets confused in the handoff. // Anyway, so call waitpid here to finally reap it. PlatformSP platform_sp(GetTarget().GetPlatform()); if (platform_sp && platform_sp->IsHost()) { @@ -2681,9 +2649,8 @@ if (GetTarget().GetNonStopModeEnabled() == false) m_stop_packet_stack.clear(); - // Add this stop packet to the stop packet stack - // This stack will get popped and examined when we switch to the - // Stopped state + // Add this stop packet to the stop packet stack This stack will get popped + // and examined when we switch to the Stopped state m_stop_packet_stack.push_back(response); } } @@ -2715,12 +2682,11 @@ } void ProcessGDBRemote::WillPublicStop() { - // See if the GDB remote client supports the JSON threads info. - // If so, we gather stop info for all threads, expedited registers, - // expedited memory, runtime queue information (iOS and MacOSX only), - // and more. Expediting memory will help stack backtracing be much - // faster. Expediting registers will make sure we don't have to read - // the thread registers for GPRs. + // See if the GDB remote client supports the JSON threads info. If so, we + // gather stop info for all threads, expedited registers, expedited memory, + // runtime queue information (iOS and MacOSX only), and more. Expediting + // memory will help stack backtracing be much faster. Expediting registers + // will make sure we don't have to read the thread registers for GPRs. m_jthreadsinfo_sp = m_gdb_comm.GetThreadsInfo(); if (m_jthreadsinfo_sp) { @@ -2770,14 +2736,13 @@ error.Clear(); if (binary_memory_read) { // The lower level GDBRemoteCommunication packet receive layer has - // already de-quoted any - // 0x7d character escaping that was present in the packet + // already de-quoted any 0x7d character escaping that was present in + // the packet size_t data_received_size = response.GetBytesLeft(); if (data_received_size > size) { // Don't write past the end of BUF if the remote debug server gave us - // too - // much data for some reason. + // too much data for some reason. data_received_size = size; } memcpy(buf, response.GetStringRef().data(), data_received_size); @@ -2816,10 +2781,10 @@ if (error.Success()) error = FlashDone(); else - // Even though some of the writing failed, try to send a flash done if - // some of the writing succeeded so the flash state is reset to normal, - // but don't stomp on the error status that was set in the write failure - // since that's the one we want to report back. + // Even though some of the writing failed, try to send a flash done if some + // of the writing succeeded so the flash state is reset to normal, but + // don't stomp on the error status that was set in the write failure since + // that's the one we want to report back. FlashDone(); m_allow_flash_writes = false; return error; @@ -2869,17 +2834,17 @@ return status; // We haven't erased the entire range, but we may have erased part of it. - // (e.g., block A is already erased and range starts in A and ends in B). - // So, adjust range if necessary to exclude already erased blocks. + // (e.g., block A is already erased and range starts in A and ends in B). So, + // adjust range if necessary to exclude already erased blocks. if (!m_erased_flash_ranges.IsEmpty()) { // Assuming that writes and erasures are done in increasing addr order, - // because that is a requirement of the vFlashWrite command. Therefore, - // we only need to look at the last range in the list for overlap. + // because that is a requirement of the vFlashWrite command. Therefore, we + // only need to look at the last range in the list for overlap. const auto &last_range = *m_erased_flash_ranges.Back(); if (range.GetRangeBase() < last_range.GetRangeEnd()) { auto overlap = last_range.GetRangeEnd() - range.GetRangeBase(); - // overlap will be less than range.GetByteSize() or else HasErased() would - // have been true + // overlap will be less than range.GetByteSize() or else HasErased() + // would have been true range.SetByteSize(range.GetByteSize() - overlap); range.SetRangeBase(range.GetRangeBase() + overlap); } @@ -3074,8 +3039,8 @@ switch (supported) { case eLazyBoolCalculate: - // We should never be deallocating memory without allocating memory - // first so we should never get eLazyBoolCalculate + // We should never be deallocating memory without allocating memory first + // so we should never get eLazyBoolCalculate error.SetErrorString( "tried to deallocate memory without ever allocating memory"); break; @@ -3147,18 +3112,14 @@ const size_t bp_op_size = GetSoftwareBreakpointTrapOpcode(bp_site); // SupportsGDBStoppointPacket() simply checks a boolean, indicating if this - // breakpoint type - // is supported by the remote stub. These are set to true by default, and - // later set to false - // only after we receive an unimplemented response when sending a breakpoint - // packet. This means - // initially that unless we were specifically instructed to use a hardware - // breakpoint, LLDB will - // attempt to set a software breakpoint. HardwareRequired() also queries a - // boolean variable which - // indicates if the user specifically asked for hardware breakpoints. If true - // then we will - // skip over software breakpoints. + // breakpoint type is supported by the remote stub. These are set to true by + // default, and later set to false only after we receive an unimplemented + // response when sending a breakpoint packet. This means initially that + // unless we were specifically instructed to use a hardware breakpoint, LLDB + // will attempt to set a software breakpoint. HardwareRequired() also queries + // a boolean variable which indicates if the user specifically asked for + // hardware breakpoints. If true then we will skip over software + // breakpoints. if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointSoftware) && (!bp_site->HardwareRequired())) { // Try to send off a software breakpoint packet ($Z0) @@ -3171,19 +3132,14 @@ return error; } - // SendGDBStoppointTypePacket() will return an error if it was unable to set - // this - // breakpoint. We need to differentiate between a error specific to placing - // this breakpoint - // or if we have learned that this breakpoint type is unsupported. To do - // this, we - // must test the support boolean for this breakpoint type to see if it now - // indicates that - // this breakpoint type is unsupported. If they are still supported then we - // should return + // SendGDBStoppointTypePacket() will return an error if it was unable to + // set this breakpoint. We need to differentiate between a error specific + // to placing this breakpoint or if we have learned that this breakpoint + // type is unsupported. To do this, we must test the support boolean for + // this breakpoint type to see if it now indicates that this breakpoint + // type is unsupported. If they are still supported then we should return // with the error code. If they are now unsupported, then we would like to - // fall through - // and try another form of breakpoint. + // fall through and try another form of breakpoint. if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointSoftware)) { if (error_no != UINT8_MAX) error.SetErrorStringWithFormat( @@ -3194,21 +3150,18 @@ } // We reach here when software breakpoints have been found to be - // unsupported. For future - // calls to set a breakpoint, we will not attempt to set a breakpoint with a - // type that is - // known not to be supported. + // unsupported. For future calls to set a breakpoint, we will not attempt + // to set a breakpoint with a type that is known not to be supported. if (log) log->Printf("Software breakpoints are unsupported"); // So we will fall through and try a hardware breakpoint } - // The process of setting a hardware breakpoint is much the same as above. We - // check the - // supported boolean for this breakpoint type, and if it is thought to be - // supported then we - // will try to set this breakpoint with a hardware breakpoint. + // The process of setting a hardware breakpoint is much the same as above. + // We check the supported boolean for this breakpoint type, and if it is + // thought to be supported then we will try to set this breakpoint with a + // hardware breakpoint. if (m_gdb_comm.SupportsGDBStoppointPacket(eBreakpointHardware)) { // Try to send off a hardware breakpoint packet ($Z1) uint8_t error_no = m_gdb_comm.SendGDBStoppointTypePacket( @@ -3250,8 +3203,8 @@ return error; } - // As a last resort we want to place a manual breakpoint. An instruction - // is placed into the process memory using memory write packets. + // As a last resort we want to place a manual breakpoint. An instruction is + // placed into the process memory using memory write packets. return EnableSoftwareBreakpoint(bp_site); } @@ -3381,10 +3334,9 @@ log->Printf("ProcessGDBRemote::DisableWatchpoint (watchID = %" PRIu64 ") addr = 0x%8.8" PRIx64 " -- SUCCESS (already disabled)", watchID, (uint64_t)addr); - // See also 'class WatchpointSentry' within StopInfo.cpp. - // This disabling attempt might come from the user-supplied actions, we'll - // route it in order for - // the watchpoint object to intelligently process this action. + // See also 'class WatchpointSentry' within StopInfo.cpp. This disabling + // attempt might come from the user-supplied actions, we'll route it in + // order for the watchpoint object to intelligently process this action. wp->SetEnabled(false, notify); return error; } @@ -3469,8 +3421,8 @@ static FileSpec g_debugserver_file_spec; ProcessLaunchInfo debugserver_launch_info; - // Make debugserver run in its own session so signals generated by - // special terminal key sequences (^C) don't affect debugserver. + // Make debugserver run in its own session so signals generated by special + // terminal key sequences (^C) don't affect debugserver. debugserver_launch_info.SetLaunchInSeparateProcessGroup(true); const std::weak_ptr this_wp = @@ -3510,8 +3462,8 @@ if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID) { #ifdef USE_SOCKETPAIR_FOR_LOCAL_CONNECTION - // Our process spawned correctly, we can now set our connection to use our - // end of the socket pair + // Our process spawned correctly, we can now set our connection to use + // our end of the socket pair cleanup_our.disable(); m_gdb_comm.SetConnection(new ConnectionFileDescriptor(our_socket, true)); #endif @@ -3528,8 +3480,8 @@ } if (m_gdb_comm.IsConnected()) { - // Finish the connection process by doing the handshake without connecting - // (send NULL URL) + // Finish the connection process by doing the handshake without + // connecting (send NULL URL) ConnectToDebugserver(""); } else { error.SetErrorString("connection failed"); @@ -3544,8 +3496,8 @@ int signo, // Zero for no signal int exit_status // Exit value of process if signal is zero ) { - // "debugserver_pid" argument passed in is the process ID for - // debugserver that we are tracking... + // "debugserver_pid" argument passed in is the process ID for debugserver + // that we are tracking... Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); const bool handled = true; @@ -3561,12 +3513,12 @@ if (!process_sp || process_sp->m_debugserver_pid != debugserver_pid) return handled; - // Sleep for a half a second to make sure our inferior process has - // time to set its exit status before we set it incorrectly when - // both the debugserver and the inferior process shut down. + // Sleep for a half a second to make sure our inferior process has time to + // set its exit status before we set it incorrectly when both the debugserver + // and the inferior process shut down. usleep(500000); - // If our process hasn't yet exited, debugserver might have died. - // If the process did exit, then we are reaping it. + // If our process hasn't yet exited, debugserver might have died. If the + // process did exit, then we are reaping it. const StateType state = process_sp->GetState(); if (state != eStateInvalid && state != eStateUnloaded && @@ -3589,8 +3541,8 @@ process_sp->SetExitStatus(-1, error_str); } - // Debugserver has exited we need to let our ProcessGDBRemote - // know that it no longer has a debugserver instance + // Debugserver has exited we need to let our ProcessGDBRemote know that it no + // longer has a debugserver instance process_sp->m_debugserver_pid = LLDB_INVALID_PROCESS_ID; return handled; } @@ -3680,10 +3632,9 @@ // check for more stop reasons HandleStopReplySequence(); - // if the process is stopped then we need to fake a resume - // so that we can stop properly with the new break. This - // is possible due to SetPrivateState() broadcasting the - // state change as a side effect. + // if the process is stopped then we need to fake a resume so that we can + // stop properly with the new break. This is possible due to + // SetPrivateState() broadcasting the state change as a side effect. if (GetPrivateState() == lldb::StateType::eStateStopped) { SetPrivateState(lldb::StateType::eStateRunning); } @@ -3756,12 +3707,11 @@ response); // We need to immediately clear the thread ID list so we are sure - // to get a valid list of threads. - // The thread ID list might be contained within the "response", or - // the stop reply packet that + // to get a valid list of threads. The thread ID list might be + // contained within the "response", or the stop reply packet that // caused the stop. So clear it now before we give the stop reply - // packet to the process - // using the process->SetLastStopPacket()... + // packet to the process using the + // process->SetLastStopPacket()... process->ClearThreadIDList(); switch (stop_state) { @@ -3798,8 +3748,7 @@ // Check to see if we were trying to attach and if we got back // the "E87" error code from debugserver -- this indicates that // the process is not debuggable. Return a slightly more - // helpful - // error message about why the attach failed. + // helpful error message about why the attach failed. if (::strstr(continue_cstr, "vAttach") != NULL && response.GetError() == 0x87) { process->SetExitStatus(-1, "cannot attach to process due to " @@ -3918,8 +3867,8 @@ Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS)); LLDB_LOG(log, "Check if need to update ignored signals"); - // QPassSignals package is not supported by the server, - // there is no way we can ignore any signals on server side. + // QPassSignals package is not supported by the server, there is no way we + // can ignore any signals on server side. if (!m_gdb_comm.GetQPassSignalsSupported()) return Status(); @@ -4043,9 +3992,9 @@ // FIXME the final character of a JSON dictionary, '}', is the escape // character in gdb-remote binary mode. lldb currently doesn't escape - // these characters in its packet output -- so we add the quoted version - // of the } character here manually in case we talk to a debugserver which - // un-escapes the characters at packet read time. + // these characters in its packet output -- so we add the quoted version of + // the } character here manually in case we talk to a debugserver which un- + // escapes the characters at packet read time. packet << (char)(0x7d ^ 0x20); StringExtractorGDBRemote response; @@ -4115,9 +4064,9 @@ // FIXME the final character of a JSON dictionary, '}', is the escape // character in gdb-remote binary mode. lldb currently doesn't escape - // these characters in its packet output -- so we add the quoted version - // of the } character here manually in case we talk to a debugserver which - // un-escapes the characters at packet read time. + // these characters in its packet output -- so we add the quoted version of + // the } character here manually in case we talk to a debugserver which un- + // escapes the characters at packet read time. packet << (char)(0x7d ^ 0x20); StringExtractorGDBRemote response; @@ -4148,9 +4097,9 @@ // FIXME the final character of a JSON dictionary, '}', is the escape // character in gdb-remote binary mode. lldb currently doesn't escape - // these characters in its packet output -- so we add the quoted version - // of the } character here manually in case we talk to a debugserver which - // un-escapes the characters at packet read time. + // these characters in its packet output -- so we add the quoted version of + // the } character here manually in case we talk to a debugserver which un- + // escapes the characters at packet read time. packet << (char)(0x7d ^ 0x20); StringExtractorGDBRemote response; @@ -4175,14 +4124,14 @@ return m_gdb_comm.ConfigureRemoteStructuredData(type_name, config_sp); } -// Establish the largest memory read/write payloads we should use. -// If the remote stub has a max packet size, stay under that size. +// Establish the largest memory read/write payloads we should use. If the +// remote stub has a max packet size, stay under that size. // -// If the remote stub's max packet size is crazy large, use a -// reasonable largeish default. +// If the remote stub's max packet size is crazy large, use a reasonable +// largeish default. // -// If the remote stub doesn't advertise a max packet size, use a -// conservative default. +// If the remote stub doesn't advertise a max packet size, use a conservative +// default. void ProcessGDBRemote::GetMaxMemorySize() { const uint64_t reasonable_largeish_default = 128 * 1024; @@ -4194,15 +4143,15 @@ // Save the stub's claimed maximum packet size m_remote_stub_max_memory_size = stub_max_size; - // Even if the stub says it can support ginormous packets, - // don't exceed our reasonable largeish default packet size. + // Even if the stub says it can support ginormous packets, don't exceed + // our reasonable largeish default packet size. if (stub_max_size > reasonable_largeish_default) { stub_max_size = reasonable_largeish_default; } - // Memory packet have other overheads too like Maddr,size:#NN - // Instead of calculating the bytes taken by size and addr every - // time, we take a maximum guess here. + // Memory packet have other overheads too like Maddr,size:#NN Instead of + // calculating the bytes taken by size and addr every time, we take a + // maximum guess here. if (stub_max_size > 70) stub_max_size -= 32 + 32 + 6; else { @@ -4293,8 +4242,8 @@ uint32_t &update) { if (m_gdb_comm.GetOSVersion(major, minor, update)) return true; - // We failed to get the host OS version, defer to the base - // implementation to correctly invalidate the arguments. + // We failed to get the host OS version, defer to the base implementation to + // correctly invalidate the arguments. return Process::GetHostOSVersion(major, minor, update); } @@ -4460,8 +4409,8 @@ } // Only update the register set name if we didn't get a "reg_set" + // attribute. "set_name" will be empty if we didn't have a "reg_set" // attribute. - // "set_name" will be empty if we didn't have a "reg_set" attribute. if (!set_name && !gdb_group.empty()) set_name.SetCString(gdb_group.c_str()); @@ -4488,8 +4437,8 @@ } // namespace {} -// query the target of gdb-remote for extended target information -// return: 'true' on success +// query the target of gdb-remote for extended target information return: +// 'true' on success // 'false' on failure bool ProcessGDBRemote::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) { // Make sure LLDB has an XML parser it can use first @@ -4576,10 +4525,9 @@ uint32_t cur_reg_num = 0; uint32_t reg_offset = 0; - // Don't use Process::GetABI, this code gets called from DidAttach, and in - // that context we haven't - // set the Target's architecture yet, so the ABI is also potentially - // incorrect. + // Don't use Process::GetABI, this code gets called from DidAttach, and + // in that context we haven't set the Target's architecture yet, so the + // ABI is also potentially incorrect. ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), arch_to_use); for (auto &feature_node : feature_nodes) { ParseRegisters(feature_node, target_info, this->m_register_info, @@ -4920,8 +4868,8 @@ // do anything Process::ModulesDidLoad(module_list); - // After loading shared libraries, we can ask our remote GDB server if - // it needs any symbols. + // After loading shared libraries, we can ask our remote GDB server if it + // needs any symbols. m_gdb_comm.ServeSymbolLookups(this); } @@ -4979,8 +4927,8 @@ has_used_usec = true; usec_value.getAsInteger(0, curr_used_usec); } else { - // We didn't find what we want, it is probably - // an older version. Bail out. + // We didn't find what we want, it is probably an older version. Bail + // out. profileDataExtractor.SetFilePos(input_file_pos); } } @@ -5002,8 +4950,8 @@ ((real_used_usec > 0) || (HasAssignedIndexIDToThread(thread_id))); if (good_first_time || good_subsequent_time) { - // We try to avoid doing too many index id reservation, - // resulting in fast increase of index ids. + // We try to avoid doing too many index id reservation, resulting in + // fast increase of index ids. output_stream << name << ":"; int32_t index_id = AssignIndexIDToThread(thread_id); @@ -5063,8 +5011,7 @@ return StructuredData::ObjectSP(); } - // This is an asynchronous JSON packet, destined for a - // StructuredDataPlugin. + // This is an asynchronous JSON packet, destined for a StructuredDataPlugin. StructuredData::ObjectSP json_sp = StructuredData::ParseJSON(packet); if (log) { if (json_sp) { Index: lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp +++ lldb/trunk/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp @@ -80,10 +80,9 @@ const char *ThreadGDBRemote::GetQueueName() { // If our cached queue info is valid, then someone called - // ThreadGDBRemote::SetQueueInfo(...) - // with valid information that was gleaned from the stop reply packet. In this - // case we trust - // that the info is valid in m_dispatch_queue_name without refetching it + // ThreadGDBRemote::SetQueueInfo(...) with valid information that was gleaned + // from the stop reply packet. In this case we trust that the info is valid + // in m_dispatch_queue_name without refetching it if (CachedQueueInfoIsValid()) { if (m_dispatch_queue_name.empty()) return nullptr; @@ -115,10 +114,9 @@ QueueKind ThreadGDBRemote::GetQueueKind() { // If our cached queue info is valid, then someone called - // ThreadGDBRemote::SetQueueInfo(...) - // with valid information that was gleaned from the stop reply packet. In this - // case we trust - // that the info is valid in m_dispatch_queue_name without refetching it + // ThreadGDBRemote::SetQueueInfo(...) with valid information that was gleaned + // from the stop reply packet. In this case we trust that the info is valid + // in m_dispatch_queue_name without refetching it if (CachedQueueInfoIsValid()) { return m_queue_kind; } @@ -141,10 +139,9 @@ queue_id_t ThreadGDBRemote::GetQueueID() { // If our cached queue info is valid, then someone called - // ThreadGDBRemote::SetQueueInfo(...) - // with valid information that was gleaned from the stop reply packet. In this - // case we trust - // that the info is valid in m_dispatch_queue_name without refetching it + // ThreadGDBRemote::SetQueueInfo(...) with valid information that was gleaned + // from the stop reply packet. In this case we trust that the info is valid + // in m_dispatch_queue_name without refetching it if (CachedQueueInfoIsValid()) return m_queue_serial_number; @@ -275,11 +272,11 @@ // Invalidate all registers in our register context. We don't set "force" to // true because the stop reply packet might have had some register values // that were expedited and these will already be copied into the register - // context by the time this function gets called. The GDBRemoteRegisterContext - // class has been made smart enough to detect when it needs to invalidate - // which registers are valid by putting hooks in the register read and - // register supply functions where they check the process stop ID and do - // the right thing. + // context by the time this function gets called. The + // GDBRemoteRegisterContext class has been made smart enough to detect when + // it needs to invalidate which registers are valid by putting hooks in the + // register read and register supply functions where they check the process + // stop ID and do the right thing. const bool force = false; GetRegisterContext()->InvalidateIfNeeded(force); } @@ -310,7 +307,8 @@ if (process_sp) { ProcessGDBRemote *gdb_process = static_cast(process_sp.get()); - // read_all_registers_at_once will be true if 'p' packet is not supported. + // read_all_registers_at_once will be true if 'p' packet is not + // supported. bool read_all_registers_at_once = !gdb_process->GetGDBRemote().GetpPacketSupported(GetID()); reg_ctx_sp.reset(new GDBRemoteRegisterContext( Index: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -91,11 +91,10 @@ // For now we are just making sure the file exists for a given module if (!m_core_module_sp && m_core_file.Exists()) { - // Don't add the Target's architecture to the ModuleSpec - we may be working - // with a core file that doesn't have the correct cpusubtype in the header - // but we should still try to use it - - // ModuleSpecList::FindMatchingModuleSpec - // enforces a strict arch mach. + // Don't add the Target's architecture to the ModuleSpec - we may be + // working with a core file that doesn't have the correct cpusubtype in the + // header but we should still try to use it - + // ModuleSpecList::FindMatchingModuleSpec enforces a strict arch mach. ModuleSpec core_module_spec(m_core_file); Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, NULL, NULL, NULL)); @@ -125,10 +124,10 @@ //---------------------------------------------------------------------- ProcessMachCore::~ProcessMachCore() { Clear(); - // We need to call finalize on the process before destroying ourselves - // to make sure all of the broadcaster cleanup goes as planned. If we - // destruct this class, then Process::~Process() might have problems - // trying to fully destroy the broadcaster. + // We need to call finalize on the process before destroying ourselves to + // make sure all of the broadcaster cleanup goes as planned. If we destruct + // this class, then Process::~Process() might have problems trying to fully + // destroy the broadcaster. Finalize(); } @@ -162,11 +161,10 @@ // header.magic, header.filetype); if (header.magic == llvm::MachO::MH_MAGIC || header.magic == llvm::MachO::MH_MAGIC_64) { - // Check MH_EXECUTABLE to see if we can find the mach image - // that contains the shared library list. The dynamic loader - // (dyld) is what contains the list for user applications, - // and the mach kernel contains a global that has the list - // of kexts to load + // Check MH_EXECUTABLE to see if we can find the mach image that contains + // the shared library list. The dynamic loader (dyld) is what contains the + // list for user applications, and the mach kernel contains a global that + // has the list of kexts to load switch (header.filetype) { case llvm::MachO::MH_DYLINKER: // printf("0x%16.16" PRIx64 ": file_type = MH_DYLINKER\n", vaddr); @@ -272,13 +270,10 @@ } else { m_core_aranges.Append(range_entry); } - // Some core files don't fill in the permissions correctly. If that is the - // case - // assume read + execute so clients don't think the memory is not - // readable, - // or executable. The memory isn't writable since this plug-in doesn't - // implement - // DoWriteMemory. + // Some core files don't fill in the permissions correctly. If that is + // the case assume read + execute so clients don't think the memory is + // not readable, or executable. The memory isn't writable since this + // plug-in doesn't implement DoWriteMemory. uint32_t permissions = section->GetPermissions(); if (permissions == 0) permissions = lldb::ePermissionsReadable | lldb::ePermissionsExecutable; @@ -309,8 +304,8 @@ } // This checks for the presence of an LC_IDENT string in a core file; - // LC_IDENT is very obsolete and should not be used in new code, but - // if the load command is present, let's use the contents. + // LC_IDENT is very obsolete and should not be used in new code, but if the + // load command is present, let's use the contents. std::string corefile_identifier = core_objfile->GetIdentifierString(); if (found_main_binary_definitively == false && corefile_identifier.find("Darwin Kernel") != std::string::npos) { @@ -342,16 +337,12 @@ if (found_main_binary_definitively == false && (m_dyld_addr == LLDB_INVALID_ADDRESS || m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) { - // We need to locate the main executable in the memory ranges - // we have in the core file. We need to search for both a user-process dyld - // binary + // We need to locate the main executable in the memory ranges we have in + // the core file. We need to search for both a user-process dyld binary // and a kernel binary in memory; we must look at all the pages in the - // binary so - // we don't miss one or the other. Step through all memory segments - // searching for - // a kernel binary and for a user process dyld -- we'll decide which to - // prefer - // later if both are present. + // binary so we don't miss one or the other. Step through all memory + // segments searching for a kernel binary and for a user process dyld -- + // we'll decide which to prefer later if both are present. const size_t num_core_aranges = m_core_aranges.GetSize(); for (size_t i = 0; i < num_core_aranges; ++i) { @@ -369,13 +360,10 @@ if (found_main_binary_definitively == false && m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { // In the case of multiple kernel images found in the core file via - // exhaustive - // search, we may not pick the correct one. See if the - // DynamicLoaderDarwinKernel's - // search heuristics might identify the correct one. - // Most of the time, I expect the address from SearchForDarwinKernel() will - // be the - // same as the address we found via exhaustive search. + // exhaustive search, we may not pick the correct one. See if the + // DynamicLoaderDarwinKernel's search heuristics might identify the correct + // one. Most of the time, I expect the address from SearchForDarwinKernel() + // will be the same as the address we found via exhaustive search. if (GetTarget().GetArchitecture().IsValid() == false && m_core_module_sp.get()) { @@ -383,13 +371,11 @@ } // SearchForDarwinKernel will end up calling back into this this class in - // the GetImageInfoAddress - // method which will give it the m_mach_kernel_addr/m_dyld_addr it already - // has. Save that aside - // and set m_mach_kernel_addr/m_dyld_addr to an invalid address temporarily - // so - // DynamicLoaderDarwinKernel does a real search for the kernel using its own - // heuristics. + // the GetImageInfoAddress method which will give it the + // m_mach_kernel_addr/m_dyld_addr it already has. Save that aside and set + // m_mach_kernel_addr/m_dyld_addr to an invalid address temporarily so + // DynamicLoaderDarwinKernel does a real search for the kernel using its + // own heuristics. addr_t saved_mach_kernel_addr = m_mach_kernel_addr; addr_t saved_user_dyld_addr = m_dyld_addr; @@ -410,8 +396,8 @@ } } - // If we found both a user-process dyld and a kernel binary, we need to decide - // which to prefer. + // If we found both a user-process dyld and a kernel binary, we need to + // decide which to prefer. if (GetCorefilePreference() == eKernelCorefile) { if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { if (log) @@ -444,18 +430,13 @@ if (m_dyld_plugin_name != DynamicLoaderMacOSXDYLD::GetPluginNameStatic()) { // For non-user process core files, the permissions on the core file - // segments are usually - // meaningless, they may be just "read", because we're dealing with kernel - // coredumps or - // early startup coredumps and the dumper is grabbing pages of memory - // without knowing - // what they are. If they aren't marked as "exeuctable", that can break the - // unwinder - // which will check a pc value to see if it is in an executable segment and - // stop the + // segments are usually meaningless, they may be just "read", because we're + // dealing with kernel coredumps or early startup coredumps and the dumper + // is grabbing pages of memory without knowing what they are. If they + // aren't marked as "exeuctable", that can break the unwinder which will + // check a pc value to see if it is in an executable segment and stop the // backtrace early if it is not ("executable" and "unknown" would both be - // fine, but - // "not executable" will break the unwinder). + // fine, but "not executable" will break the unwinder). size_t core_range_infos_size = m_core_range_infos.GetSize(); for (size_t i = 0; i < core_range_infos_size; i++) { VMRangeToPermissions::Entry *ent = @@ -464,8 +445,8 @@ } } - // Even if the architecture is set in the target, we need to override - // it to match the core file which is always single arch. + // Even if the architecture is set in the target, we need to override it to + // match the core file which is always single arch. ArchSpec arch(m_core_module_sp->GetArchitecture()); if (arch.GetCore() == ArchSpec::eCore_x86_32_i486) { arch = Platform::GetAugmentedArchSpec(GetTarget().GetPlatform().get(), "i386"); @@ -488,8 +469,7 @@ ThreadList &new_thread_list) { if (old_thread_list.GetSize(false) == 0) { // Make up the thread the first time this is called so we can setup our one - // and only - // core thread state. + // and only core thread state. ObjectFile *core_objfile = m_core_module_sp->GetObjectFile(); if (core_objfile) { @@ -508,8 +488,8 @@ } void ProcessMachCore::RefreshStateAfterStop() { - // Let all threads recover from stopping and do any clean up based - // on the previous thread state (if any). + // Let all threads recover from stopping and do any clean up based on the + // previous thread state (if any). m_thread_list.RefreshStateAfterStop(); // SetThreadStopInfo (m_last_stop_packet); } @@ -529,8 +509,8 @@ //------------------------------------------------------------------ size_t ProcessMachCore::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) { - // Don't allow the caching that lldb_private::Process::ReadMemory does - // since in core files we have it all cached our our core file anyway. + // Don't allow the caching that lldb_private::Process::ReadMemory does since + // in core files we have it all cached our our core file anyway. return DoReadMemory(addr, buf, size, error); } @@ -546,19 +526,17 @@ // Address Size File off File size // ---------- ---------- ---------- ---------- // LC_SEGMENT 0x000f6000 0x00001000 0x1d509ee8 0x00001000 --- --- 0 - // 0x00000000 __TEXT - // LC_SEGMENT 0x0f600000 0x00100000 0x1d50aee8 0x00100000 --- --- 0 - // 0x00000000 __TEXT - // LC_SEGMENT 0x000f7000 0x00001000 0x1d60aee8 0x00001000 --- --- 0 - // 0x00000000 __TEXT + // 0x00000000 __TEXT LC_SEGMENT 0x0f600000 0x00100000 0x1d50aee8 0x00100000 + // --- --- 0 0x00000000 __TEXT LC_SEGMENT 0x000f7000 0x00001000 + // 0x1d60aee8 0x00001000 --- --- 0 0x00000000 __TEXT // // Any if the user executes the following command: // // (lldb) mem read 0xf6ff0 // - // We would attempt to read 32 bytes from 0xf6ff0 but would only - // get 16 unless we loop through consecutive memory ranges that are - // contiguous in the address space, but not in the file data. + // We would attempt to read 32 bytes from 0xf6ff0 but would only get 16 + // unless we loop through consecutive memory ranges that are contiguous in + // the address space, but not in the file data. //---------------------------------------------------------------------- while (bytes_read < size) { const addr_t curr_addr = addr + bytes_read; @@ -641,8 +619,8 @@ } addr_t ProcessMachCore::GetImageInfoAddress() { - // If we found both a user-process dyld and a kernel binary, we need to decide - // which to prefer. + // If we found both a user-process dyld and a kernel binary, we need to + // decide which to prefer. if (GetCorefilePreference() == eKernelCorefile) { if (m_mach_kernel_addr != LLDB_INVALID_ADDRESS) { return m_mach_kernel_addr; Index: lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp +++ lldb/trunk/source/Plugins/Process/mach-core/ThreadMachCore.cpp @@ -54,8 +54,8 @@ // context by the time this function gets called. The KDPRegisterContext // class has been made smart enough to detect when it needs to invalidate // which registers are valid by putting hooks in the register read and - // register supply functions where they check the process stop ID and do - // the right thing. + // register supply functions where they check the process stop ID and do the + // right thing. const bool force = false; GetRegisterContext()->InvalidateIfNeeded(force); } Index: lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp +++ lldb/trunk/source/Plugins/Process/minidump/MinidumpParser.cpp @@ -115,12 +115,12 @@ llvm::ArrayRef MinidumpParser::GetThreadContextWow64(const MinidumpThread &td) { - // On Windows, a 32-bit process can run on a 64-bit machine under - // WOW64. If the minidump was captured with a 64-bit debugger, then - // the CONTEXT we just grabbed from the mini_dump_thread is the one - // for the 64-bit "native" process rather than the 32-bit "guest" - // process we care about. In this case, we can get the 32-bit CONTEXT - // from the TEB (Thread Environment Block) of the 64-bit process. + // On Windows, a 32-bit process can run on a 64-bit machine under WOW64. If + // the minidump was captured with a 64-bit debugger, then the CONTEXT we just + // grabbed from the mini_dump_thread is the one for the 64-bit "native" + // process rather than the 32-bit "guest" process we care about. In this + // case, we can get the 32-bit CONTEXT from the TEB (Thread Environment + // Block) of the 64-bit process. auto teb_mem = GetMemory(td.teb, sizeof(TEB64)); if (teb_mem.empty()) return {}; @@ -130,9 +130,9 @@ if (error.Fail()) return {}; - // Slot 1 of the thread-local storage in the 64-bit TEB points to a - // structure that includes the 32-bit CONTEXT (after a ULONG). - // See: https://msdn.microsoft.com/en-us/library/ms681670.aspx + // Slot 1 of the thread-local storage in the 64-bit TEB points to a structure + // that includes the 32-bit CONTEXT (after a ULONG). See: + // https://msdn.microsoft.com/en-us/library/ms681670.aspx auto context = GetMemory(wow64teb->tls_slots[1] + 4, sizeof(MinidumpContext_x86_32)); if (context.size() < sizeof(MinidumpContext_x86_32)) @@ -334,10 +334,10 @@ } } - // Some Minidumps have a Memory64ListStream that captures all the heap - // memory (full-memory Minidumps). We can't exactly use the same loop as - // above, because the Minidump uses slightly different data structures to - // describe those + // Some Minidumps have a Memory64ListStream that captures all the heap memory + // (full-memory Minidumps). We can't exactly use the same loop as above, + // because the Minidump uses slightly different data structures to describe + // those if (!data64.empty()) { llvm::ArrayRef memory64_list; @@ -377,8 +377,8 @@ return {}; // There's at least some overlap between the beginning of the desired range - // (addr) and the current range. Figure out where the overlap begins and - // how much overlap there is. + // (addr) and the current range. Figure out where the overlap begins and how + // much overlap there is. const size_t offset = addr - range->start; Index: lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp +++ lldb/trunk/source/Plugins/Process/minidump/MinidumpTypes.cpp @@ -55,10 +55,9 @@ return llvm::None; auto source_start = reinterpret_cast(data.data()); - // source_length is the length of the string in bytes - // we need the length of the string in UTF-16 characters/code points (16 bits - // per char) - // that's why it's divided by 2 + // source_length is the length of the string in bytes we need the length of + // the string in UTF-16 characters/code points (16 bits per char) that's why + // it's divided by 2 const auto source_end = source_start + source_length / 2; // resize to worst case length result.resize(UNI_MAX_UTF8_BYTES_PER_CODE_POINT * source_length / 2); Index: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp @@ -49,8 +49,8 @@ PlaceholderModule(const FileSpec &file_spec, const ArchSpec &arch) : Module(file_spec, arch) {} - // Creates a synthetic module section covering the whole module image - // (and sets the section load address as well) + // Creates a synthetic module section covering the whole module image (and + // sets the section load address as well) void CreateImageSection(const MinidumpModule *module, Target& target) { const ConstString section_name(".module_image"); lldb::SectionSP section_sp(new Section( @@ -137,10 +137,10 @@ ProcessMinidump::~ProcessMinidump() { Clear(); - // We need to call finalize on the process before destroying ourselves - // to make sure all of the broadcaster cleanup goes as planned. If we - // destruct this class, then Process::~Process() might have problems - // trying to fully destroy the broadcaster. + // We need to call finalize on the process before destroying ourselves to + // make sure all of the broadcaster cleanup goes as planned. If we destruct + // this class, then Process::~Process() might have problems trying to fully + // destroy the broadcaster. Finalize(); } @@ -230,8 +230,8 @@ size_t ProcessMinidump::ReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) { - // Don't allow the caching that lldb_private::Process::ReadMemory does - // since we have it all cached in our dump file anyway. + // Don't allow the caching that lldb_private::Process::ReadMemory does since + // we have it all cached in our dump file anyway. return DoReadMemory(addr, buf, size, error); } @@ -327,9 +327,9 @@ Status error; lldb::ModuleSP module_sp = GetTarget().GetSharedModule(module_spec, &error); if (!module_sp || error.Fail()) { - // We failed to locate a matching local object file. Fortunately, - // the minidump format encodes enough information about each module's - // memory range to allow us to create placeholder modules. + // We failed to locate a matching local object file. Fortunately, the + // minidump format encodes enough information about each module's memory + // range to allow us to create placeholder modules. // // This enables most LLDB functionality involving address-to-module // translations (ex. identifing the module for a stack frame PC) and Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -123,21 +123,20 @@ } PythonObject PythonObject::ResolveName(llvm::StringRef name) const { - // Resolve the name in the context of the specified object. If, - // for example, `this` refers to a PyModule, then this will look for - // `name` in this module. If `this` refers to a PyType, then it will - // resolve `name` as an attribute of that type. If `this` refers to - // an instance of an object, then it will resolve `name` as the value - // of the specified field. + // Resolve the name in the context of the specified object. If, for example, + // `this` refers to a PyModule, then this will look for `name` in this + // module. If `this` refers to a PyType, then it will resolve `name` as an + // attribute of that type. If `this` refers to an instance of an object, + // then it will resolve `name` as the value of the specified field. // // This function handles dotted names so that, for example, if `m_py_obj` - // refers to the `sys` module, and `name` == "path.append", then it - // will find the function `sys.path.append`. + // refers to the `sys` module, and `name` == "path.append", then it will find + // the function `sys.path.append`. size_t dot_pos = name.find_first_of('.'); if (dot_pos == llvm::StringRef::npos) { - // No dots in the name, we should be able to find the value immediately - // as an attribute of `m_py_obj`. + // No dots in the name, we should be able to find the value immediately as + // an attribute of `m_py_obj`. return GetAttributeValue(name); } @@ -230,8 +229,8 @@ } void PythonBytes::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonBytes::Check(py_obj)) { @@ -240,8 +239,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -303,8 +301,8 @@ } void PythonByteArray::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonByteArray::Check(py_obj)) { @@ -313,8 +311,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -378,8 +375,8 @@ } void PythonString::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonString::Check(py_obj)) { @@ -394,8 +391,7 @@ result.Reset(PyRefType::Owned, PyUnicode_AsUTF8String(result.get())); #endif // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -466,8 +462,8 @@ return false; #if PY_MAJOR_VERSION >= 3 - // Python 3 does not have PyInt_Check. There is only one type of - // integral value, long. + // Python 3 does not have PyInt_Check. There is only one type of integral + // value, long. return PyLong_Check(py_obj); #else return PyLong_Check(py_obj) || PyInt_Check(py_obj); @@ -475,8 +471,8 @@ } void PythonInteger::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonInteger::Check(py_obj)) { @@ -485,13 +481,13 @@ } #if PY_MAJOR_VERSION < 3 - // Always store this as a PyLong, which makes interoperability between - // Python 2.x and Python 3.x easier. This is only necessary in 2.x, - // since 3.x doesn't even have a PyInt. + // Always store this as a PyLong, which makes interoperability between Python + // 2.x and Python 3.x easier. This is only necessary in 2.x, since 3.x + // doesn't even have a PyInt. if (PyInt_Check(py_obj)) { // Since we converted the original object to a different type, the new - // object is an owned object regardless of the ownership semantics requested - // by the user. + // object is an owned object regardless of the ownership semantics + // requested by the user. result.Reset(PyRefType::Owned, PyLong_FromLongLong(PyInt_AsLong(py_obj))); } #endif @@ -500,8 +496,7 @@ "Couldn't get a PyLong from this PyObject"); // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -513,10 +508,9 @@ int overflow = 0; int64_t result = PyLong_AsLongLongAndOverflow(m_py_obj, &overflow); if (overflow != 0) { - // We got an integer that overflows, like 18446744072853913392L - // we can't use PyLong_AsLongLong() as it will return - // 0xffffffffffffffff. If we use the unsigned long long - // it will work as expected. + // We got an integer that overflows, like 18446744072853913392L we can't + // use PyLong_AsLongLong() as it will return 0xffffffffffffffff. If we + // use the unsigned long long it will work as expected. const uint64_t uval = PyLong_AsUnsignedLongLong(m_py_obj); result = static_cast(uval); } @@ -563,8 +557,8 @@ } void PythonList::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonList::Check(py_obj)) { @@ -573,8 +567,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -668,8 +661,8 @@ } void PythonTuple::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonTuple::Check(py_obj)) { @@ -678,8 +671,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -741,8 +733,8 @@ } void PythonDictionary::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonDictionary::Check(py_obj)) { @@ -751,8 +743,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -833,8 +824,8 @@ } void PythonModule::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonModule::Check(py_obj)) { @@ -843,8 +834,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -871,8 +861,8 @@ } void PythonCallable::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonCallable::Check(py_obj)) { @@ -881,8 +871,7 @@ } // Calling PythonObject::Reset(const PythonObject&) will lead to stack - // overflow since it calls - // back into the virtual implementation. + // overflow since it calls back into the virtual implementation. PythonObject::Reset(PyRefType::Borrowed, result.get()); } @@ -963,9 +952,9 @@ #else // In Python 3, there is no `PyFile_Check`, and in fact PyFile is not even a // first-class object type anymore. `PyFile_FromFd` is just a thin wrapper - // over `io.open()`, which returns some object derived from `io.IOBase`. - // As a result, the only way to detect a file in Python 3 is to check whether - // it inherits from `io.IOBase`. Since it is possible for non-files to also + // over `io.open()`, which returns some object derived from `io.IOBase`. As a + // result, the only way to detect a file in Python 3 is to check whether it + // inherits from `io.IOBase`. Since it is possible for non-files to also // inherit from `io.IOBase`, we additionally verify that it has the `fileno` // attribute, which should guarantee that it is backed by the file system. PythonObject io_module(PyRefType::Owned, PyImport_ImportModule("io")); @@ -985,8 +974,8 @@ } void PythonFile::Reset(PyRefType type, PyObject *py_obj) { - // Grab the desired reference type so that if we end up rejecting - // `py_obj` it still gets decremented if necessary. + // Grab the desired reference type so that if we end up rejecting `py_obj` it + // still gets decremented if necessary. PythonObject result(type, py_obj); if (!PythonFile::Check(py_obj)) { Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp @@ -30,9 +30,9 @@ } void PythonExceptionState::Acquire(bool restore_on_exit) { - // If a state is already acquired, the user needs to decide whether they - // want to discard or restore it. Don't allow the potential silent - // loss of a valid state. + // If a state is already acquired, the user needs to decide whether they want + // to discard or restore it. Don't allow the potential silent loss of a + // valid state. assert(!IsError()); if (!HasErrorOccurred()) @@ -45,8 +45,7 @@ // PyErr_Fetch clears the error flag. assert(!HasErrorOccurred()); - // Ownership of the objects returned by `PyErr_Fetch` is transferred - // to us. + // Ownership of the objects returned by `PyErr_Fetch` is transferred to us. m_type.Reset(PyRefType::Owned, py_type); m_value.Reset(PyRefType::Owned, py_value); m_traceback.Reset(PyRefType::Owned, py_traceback); @@ -56,14 +55,14 @@ void PythonExceptionState::Restore() { if (m_type.IsValid()) { // The documentation for PyErr_Restore says "Do not pass a null type and - // non-null value or traceback. So only restore if type was non-null - // to begin with. In this case we're passing ownership back to Python - // so release them all. + // non-null value or traceback. So only restore if type was non-null to + // begin with. In this case we're passing ownership back to Python so + // release them all. PyErr_Restore(m_type.release(), m_value.release(), m_traceback.release()); } - // After we restore, we should not hold onto the exception state. Demand that - // it be re-acquired. + // After we restore, we should not hold onto the exception state. Demand + // that it be re-acquired. Discard(); } @@ -100,10 +99,10 @@ if (!IsError()) return std::string(); - // It's possible that ReadPythonBacktrace generated another exception. - // If this happens we have to clear the exception, because otherwise - // PyObject_Str() will assert below. That's why we needed to do the - // save / restore at the beginning of this function. + // It's possible that ReadPythonBacktrace generated another exception. If + // this happens we have to clear the exception, because otherwise + // PyObject_Str() will assert below. That's why we needed to do the save / + // restore at the beginning of this function. PythonExceptionState bt_error_state(false); std::string error_string; @@ -114,8 +113,8 @@ // If we were able to read the backtrace, just append it. error_stream << backtrace << "\n"; } else { - // Otherwise, append some information about why we were unable to - // obtain the backtrace. + // Otherwise, append some information about why we were unable to obtain + // the backtrace. PythonString bt_error = bt_error_state.GetValue().Str(); error_stream << "An error occurred while retrieving the backtrace: " << bt_error.GetString() << "\n"; Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -112,13 +112,12 @@ namespace { -// Initializing Python is not a straightforward process. We cannot control what -// external code may have done before getting to this point in LLDB, including -// potentially having already initialized Python, so we need to do a lot of work -// to ensure that the existing state of the system is maintained across our -// initialization. We do this by using an RAII pattern where we save off -// initial -// state at the beginning, and restore it at the end +// Initializing Python is not a straightforward process. We cannot control +// what external code may have done before getting to this point in LLDB, +// including potentially having already initialized Python, so we need to do a +// lot of work to ensure that the existing state of the system is maintained +// across our initialization. We do this by using an RAII pattern where we +// save off initial state at the beginning, and restore it at the end struct InitializePythonRAII { public: InitializePythonRAII() @@ -210,12 +209,11 @@ LLDB_LOGV(log, "Ensured PyGILState. Previous state = {0}locked", m_GILState == PyGILState_UNLOCKED ? "un" : ""); - // we need to save the thread state when we first start the command - // because we might decide to interrupt it while some action is taking - // place outside of Python (e.g. printing to screen, waiting for the network, - // ...) - // in that case, _PyThreadState_Current will be NULL - and we would be unable - // to set the asynchronous exception - not a desirable situation + // we need to save the thread state when we first start the command because + // we might decide to interrupt it while some action is taking place outside + // of Python (e.g. printing to screen, waiting for the network, ...) in that + // case, _PyThreadState_Current will be NULL - and we would be unable to set + // the asynchronous exception - not a desirable situation m_python_interpreter->SetThreadState(PyThreadState_Get()); m_python_interpreter->IncrementLockCount(); return true; @@ -281,17 +279,16 @@ PyRun_SimpleString(run_string.GetData()); // Reloading modules requires a different syntax in Python 2 and Python 3. - // This provides - // a consistent syntax no matter what version of Python. + // This provides a consistent syntax no matter what version of Python. run_string.Clear(); run_string.Printf("run_one_line (%s, 'from six.moves import reload_module')", m_dictionary_name.c_str()); PyRun_SimpleString(run_string.GetData()); // WARNING: temporary code that loads Cocoa formatters - this should be done - // on a per-platform basis rather than loading the whole set - // and letting the individual formatter classes exploit APIs to check whether - // they can/cannot do their task + // on a per-platform basis rather than loading the whole set and letting the + // individual formatter classes exploit APIs to check whether they can/cannot + // do their task run_string.Clear(); run_string.Printf( "run_one_line (%s, 'import lldb.formatters, lldb.formatters.cpp, pydoc')", @@ -314,13 +311,11 @@ } ScriptInterpreterPython::~ScriptInterpreterPython() { - // the session dictionary may hold objects with complex state - // which means that they may need to be torn down with some level of smarts - // and that, in turn, requires a valid thread state - // force Python to procure itself such a thread state, nuke the session - // dictionary - // and then release it for others to use and proceed with the rest of the - // shutdown + // the session dictionary may hold objects with complex state which means + // that they may need to be torn down with some level of smarts and that, in + // turn, requires a valid thread state force Python to procure itself such a + // thread state, nuke the session dictionary and then release it for others + // to use and proceed with the rest of the shutdown auto gil_state = PyGILState_Ensure(); m_session_dict.Reset(); PyGILState_Release(gil_state); @@ -452,16 +447,16 @@ void ScriptInterpreterPython::SaveTerminalState(int fd) { // Python mucks with the terminal state of STDIN. If we can possibly avoid // this by setting the file handles up correctly prior to entering the - // interpreter we should. For now we save and restore the terminal state - // on the input file handle. + // interpreter we should. For now we save and restore the terminal state on + // the input file handle. m_terminal_state.Save(fd, false); } void ScriptInterpreterPython::RestoreTerminalState() { // Python mucks with the terminal state of STDIN. If we can possibly avoid // this by setting the file handles up correctly prior to entering the - // interpreter we should. For now we save and restore the terminal state - // on the input file handle. + // interpreter we should. For now we save and restore the terminal state on + // the input file handle. m_terminal_state.Restore(); } @@ -470,14 +465,11 @@ if (log) log->PutCString("ScriptInterpreterPython::LeaveSession()"); - // checking that we have a valid thread state - since we use our own threading - // and locking - // in some (rare) cases during cleanup Python may end up believing we have no - // thread state - // and PyImport_AddModule will crash if that is the case - since that seems to - // only happen - // when destroying the SBDebugger, we can make do without clearing up stdout - // and stderr + // checking that we have a valid thread state - since we use our own + // threading and locking in some (rare) cases during cleanup Python may end + // up believing we have no thread state and PyImport_AddModule will crash if + // that is the case - since that seems to only happen when destroying the + // SBDebugger, we can make do without clearing up stdout and stderr // rdar://problem/11292882 // When the current thread state is NULL, PyThreadState_Get() issues a fatal @@ -526,8 +518,7 @@ bool ScriptInterpreterPython::EnterSession(uint16_t on_entry_flags, FILE *in, FILE *out, FILE *err) { // If we have already entered the session, without having officially 'left' - // it, then there is no need to - // 'enter' it again. + // it, then there is no need to 'enter' it again. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_SCRIPT)); if (m_session_is_active) { if (log) @@ -560,8 +551,8 @@ run_string.PutCString("; lldb.frame = lldb.thread.GetSelectedFrame ()"); run_string.PutCString("')"); } else { - // If we aren't initing the globals, we should still always set the debugger - // (since that is always unique.) + // If we aren't initing the globals, we should still always set the + // debugger (since that is always unique.) run_string.Printf("run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64, m_dictionary_name.c_str(), GetCommandInterpreter().GetDebugger().GetID()); @@ -702,12 +693,11 @@ if (command && command[0]) { // We want to call run_one_line, passing in the dictionary and the command - // string. We cannot do this through - // PyRun_SimpleString here because the command string may contain escaped - // characters, and putting it inside + // string. We cannot do this through PyRun_SimpleString here because the + // command string may contain escaped characters, and putting it inside // another string to pass to PyRun_SimpleString messes up the escaping. So - // we use the following more complicated - // method to pass the command string directly down to Python. + // we use the following more complicated method to pass the command string + // directly down to Python. Debugger &debugger = m_interpreter.GetDebugger(); StreamFileSP input_file_sp; @@ -773,17 +763,14 @@ FILE *err_file = error_file_sp->GetFile().GetStream(); bool success = false; { - // WARNING! It's imperative that this RAII scope be as tight as possible. - // In particular, the - // scope must end *before* we try to join the read thread. The reason for - // this is that a - // pre-requisite for joining the read thread is that we close the write - // handle (to break the - // pipe and cause it to wake up and exit). But acquiring the GIL as below - // will redirect Python's - // stdio to use this same handle. If we close the handle while Python is - // still using it, bad - // things will happen. + // WARNING! It's imperative that this RAII scope be as tight as + // possible. In particular, the scope must end *before* we try to join + // the read thread. The reason for this is that a pre-requisite for + // joining the read thread is that we close the write handle (to break + // the pipe and cause it to wake up and exit). But acquiring the GIL as + // below will redirect Python's stdio to use this same handle. If we + // close the handle while Python is still using it, bad things will + // happen. Locker locker( this, ScriptInterpreterPython::Locker::AcquireLock | @@ -827,12 +814,12 @@ } if (join_read_thread) { - // Close the write end of the pipe since we are done with our - // one line script. This should cause the read thread that - // output_comm is using to exit + // Close the write end of the pipe since we are done with our one line + // script. This should cause the read thread that output_comm is using to + // exit output_file_sp->GetFile().Close(); - // The close above should cause this thread to exit when it gets - // to the end of file, so let it get all its data + // The close above should cause this thread to exit when it gets to the + // end of file, so let it get all its data output_comm.JoinReadThread(); // Now we can close the read end of the pipe output_comm.Disconnect(); @@ -889,21 +876,18 @@ ScriptInterpreterPython::Locker::FreeAcquiredLock | ScriptInterpreterPython::Locker::TearDownSession); - // The following call drops into the embedded interpreter loop and stays - // there until the - // user chooses to exit from the Python interpreter. - // This embedded interpreter will, as any Python code that performs I/O, - // unlock the GIL before - // a system call that can hang, and lock it when the syscall has - // returned. + // The following call drops into the embedded interpreter loop and + // stays there until the user chooses to exit from the Python + // interpreter. This embedded interpreter will, as any Python code that + // performs I/O, unlock the GIL before a system call that can hang, and + // lock it when the syscall has returned. // We need to surround the call to the embedded interpreter with calls - // to PyGILState_Ensure and - // PyGILState_Release (using the Locker above). This is because Python - // has a global lock which must be held whenever we want - // to touch any Python objects. Otherwise, if the user calls Python - // code, the interpreter state will be off, - // and things could hang (it's happened before). + // to PyGILState_Ensure and PyGILState_Release (using the Locker + // above). This is because Python has a global lock which must be held + // whenever we want to touch any Python objects. Otherwise, if the user + // calls Python code, the interpreter state will be off, and things + // could hang (it's happened before). StreamString run_string; run_string.Printf("run_python_interpreter (%s)", @@ -934,12 +918,10 @@ Debugger &debugger = GetCommandInterpreter().GetDebugger(); // At the moment, the only time the debugger does not have an input file - // handle is when this is called - // directly from Python, in which case it is both dangerous and unnecessary - // (not to mention confusing) to - // try to embed a running interpreter loop inside the already running Python - // interpreter loop, so we won't - // do it. + // handle is when this is called directly from Python, in which case it is + // both dangerous and unnecessary (not to mention confusing) to try to embed + // a running interpreter loop inside the already running Python interpreter + // loop, so we won't do it. if (!debugger.GetInputFile()->GetFile().IsValid()) return; @@ -1174,10 +1156,8 @@ if (code_object.IsValid()) { // In Python 2.x, PyEval_EvalCode takes a PyCodeObject, but in Python 3.x, it -// takes -// a PyObject. They are convertible (hence the function -// PyCode_Check(PyObject*), so -// we have to do the cast for Python 2.x +// takes a PyObject. They are convertible (hence the function +// PyCode_Check(PyObject*), so we have to do the cast for Python 2.x #if PY_MAJOR_VERSION >= 3 PyObject *py_code_obj = code_object.get(); #else @@ -1243,10 +1223,9 @@ auto data_ap = llvm::make_unique(); // Split the command_body_text into lines, and pass that to - // GenerateBreakpointCommandCallbackData. That will - // wrap the body in an auto-generated function, and return the function name - // in script_source. That is what - // the callback will actually invoke. + // GenerateBreakpointCommandCallbackData. That will wrap the body in an + // auto-generated function, and return the function name in script_source. + // That is what the callback will actually invoke. data_ap->user_source.SplitIntoLines(command_body_text); Status error = GenerateBreakpointCommandCallbackData(data_ap->user_source, @@ -1268,9 +1247,8 @@ // It's necessary to set both user_source and script_source to the oneliner. // The former is used to generate callback description (as in watchpoint - // command list) - // while the latter is used for Python to interpret during the actual - // callback. + // command list) while the latter is used for Python to interpret during the + // actual callback. data_ap->user_source.AppendString(oneliner); data_ap->script_source.assign(oneliner); @@ -1365,8 +1343,7 @@ return false; // Take what the user wrote, wrap it all up inside one big auto-generated - // Python function, passing in the - // ValueObject as parameter to the function. + // Python function, passing in the ValueObject as parameter to the function. std::string auto_generated_function_name( GenerateUniqueName("lldb_autogen_python_type_print_func", @@ -1430,8 +1407,8 @@ sstr.Printf("class %s:", auto_generated_class_name.c_str()); auto_generated_class.AppendString(sstr.GetString()); - // Wrap everything up inside the class, increasing the indentation. - // we don't need to play any fancy indentation tricks here because there is no + // Wrap everything up inside the class, increasing the indentation. we don't + // need to play any fancy indentation tricks here because there is no // surrounding code whose indentation we need to honor for (int i = 0; i < num_lines; ++i) { sstr.Clear(); @@ -1439,9 +1416,8 @@ auto_generated_class.AppendString(sstr.GetString()); } - // Verify that the results are valid Python. - // (even though the method is ExportFunctionDefinitionToInterpreter, a class - // will actually be exported) + // Verify that the results are valid Python. (even though the method is + // ExportFunctionDefinitionToInterpreter, a class will actually be exported) // (TODO: rename that method to ExportDefinitionToInterpreter) if (!ExportFunctionDefinitionToInterpreter(auto_generated_class).Success()) return false; @@ -1585,8 +1561,8 @@ // GetPythonValueFormatString provides a system independent type safe way to // convert a variable's type into a python value format. Python value formats -// are defined in terms of builtin C types and could change from system to -// as the underlying typedef for uint* types, size_t, off_t and other values +// are defined in terms of builtin C types and could change from system to as +// the underlying typedef for uint* types, size_t, off_t and other values // change. template const char *GetPythonValueFormatString(T t); @@ -2044,8 +2020,7 @@ ScriptInterpreterPython::Locker::FreeAcquiredLock); // This may be called as part of Py_Finalize. In that case the modules are - // destroyed in random - // order and we can't guarantee that we can access these. + // destroyed in random order and we can't guarantee that we can access these. if (Py_IsInitialized()) PyRun_SimpleString("lldb.debugger = None; lldb.target = None; lldb.process " "= None; lldb.thread = None; lldb.frame = None"); @@ -2629,9 +2604,8 @@ command_stream.Clear(); command_stream.Printf("sys.modules.__contains__('%s')", basename.c_str()); bool does_contain = false; - // this call will succeed if the module was ever imported in any Debugger in - // the lifetime of the process - // in which this LLDB framework is living + // this call will succeed if the module was ever imported in any Debugger + // in the lifetime of the process in which this LLDB framework is living bool was_imported_globally = (ExecuteOneLineWithReturn( command_stream.GetData(), @@ -2705,8 +2679,8 @@ llvm::StringRef word_sr(word); - // filter out a few characters that would just confuse us - // and that are clearly not keyword material anyway + // filter out a few characters that would just confuse us and that are + // clearly not keyword material anyway if (word_sr.find_first_of("'\"") != llvm::StringRef::npos) return false; @@ -2834,9 +2808,9 @@ return ret_val; } -// in Python, a special attribute __doc__ contains the docstring -// for an object (function, method, class, ...) if any is defined -// Otherwise, the attribute's value is None +// in Python, a special attribute __doc__ contains the docstring for an object +// (function, method, class, ...) if any is defined Otherwise, the attribute's +// value is None bool ScriptInterpreterPython::GetDocumentationForItem(const char *item, std::string &dest) { dest.clear(); @@ -3106,10 +3080,9 @@ Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); // RAII-based initialization which correctly handles multiple-initialization, - // version- - // specific differences among Python 2 and Python 3, and saving and restoring - // various - // other pieces of state that can get mucked with during initialization. + // version- specific differences among Python 2 and Python 3, and saving and + // restoring various other pieces of state that can get mucked with during + // initialization. InitializePythonRAII initialize_guard; if (g_swig_init_callback) @@ -3123,12 +3096,9 @@ FileSpec file_spec; // Don't denormalize paths when calling file_spec.GetPath(). On platforms - // that use - // a backslash as the path separator, this will result in executing python - // code containing - // paths with unescaped backslashes. But Python also accepts forward slashes, - // so to make - // life easier we just use that. + // that use a backslash as the path separator, this will result in executing + // python code containing paths with unescaped backslashes. But Python also + // accepts forward slashes, so to make life easier we just use that. if (HostInfo::GetLLDBPath(ePathTypePythonDir, file_spec)) AddToSysPath(AddLocation::Beginning, file_spec.GetPath(false)); if (HostInfo::GetLLDBPath(ePathTypeLLDBShlibDir, file_spec)) Index: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp =================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -186,9 +186,9 @@ "subsystem" // subsystem of the log message // Consider impelmenting this action as it would be cheaper to filter. - // "message" requires always formatting the message, which is a waste - // of cycles if it ends up being rejected. - // "format", // format string used to format message text + // "message" requires always formatting the message, which is a waste of + // cycles if it ends up being rejected. "format", // format string + // used to format message text }; static const ConstString &GetDarwinLogTypeName() { @@ -239,11 +239,10 @@ // Indicate whether this is an accept or reject rule. dict_p->AddBooleanItem("accept", m_accept); - // Indicate which attribute of the message this filter references. - // This can drop into the rule-specific DoSerialization if we get - // to the point where not all FilterRule derived classes work on - // an attribute. (e.g. logical and/or and other compound - // operations). + // Indicate which attribute of the message this filter references. This can + // drop into the rule-specific DoSerialization if we get to the point where + // not all FilterRule derived classes work on an attribute. (e.g. logical + // and/or and other compound operations). dict_p->AddStringItem("attribute", s_filter_attributes[m_attribute_index]); // Indicate the type of the rule. @@ -404,9 +403,9 @@ // ------------------------------------------------------------------------- static OptionDefinition g_enable_option_table[] = { - // Source stream include/exclude options (the first-level filter). - // This one should be made as small as possible as everything that - // goes through here must be processed by the process monitor. + // Source stream include/exclude options (the first-level filter). This one + // should be made as small as possible as everything that goes through here + // must be processed by the process monitor. {LLDB_OPT_SET_ALL, false, "any-process", 'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Specifies log messages from other related processes should be " @@ -420,10 +419,10 @@ "Specifies info-level log messages should be included."}, {LLDB_OPT_SET_ALL, false, "filter", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgRawInput, - // There doesn't appear to be a great way for me to have these - // multi-line, formatted tables in help. This looks mostly right - // but there are extra linefeeds added at seemingly random spots, - // and indentation isn't handled properly on those lines. + // There doesn't appear to be a great way for me to have these multi-line, + // formatted tables in help. This looks mostly right but there are extra + // linefeeds added at seemingly random spots, and indentation isn't + // handled properly on those lines. "Appends a filter rule to the log message filter chain. Multiple " "rules may be added by specifying this option multiple times, " "once per filter rule. Filter rules are processed in the order " @@ -786,12 +785,11 @@ if (!source_name) return; - // Check if we're *not* using strict sources. If not, - // then the user is going to get debug-level info - // anyways, probably not what they're expecting. - // Unfortunately we can only fix this by adding an - // env var, which would have had to have happened - // already. Thus, a warning is the best we can do here. + // Check if we're *not* using strict sources. If not, then the user is + // going to get debug-level info anyways, probably not what they're + // expecting. Unfortunately we can only fix this by adding an env var, + // which would have had to have happened already. Thus, a warning is the + // best we can do here. StreamString stream; stream.Printf("darwin-log source settings specify to exclude " "%s messages, but setting " @@ -805,24 +803,22 @@ } bool DoExecute(Args &command, CommandReturnObject &result) override { - // First off, set the global sticky state of enable/disable - // based on this command execution. + // First off, set the global sticky state of enable/disable based on this + // command execution. s_is_explicitly_enabled = m_enable; - // Next, if this is an enable, save off the option data. - // We will need it later if a process hasn't been launched or - // attached yet. + // Next, if this is an enable, save off the option data. We will need it + // later if a process hasn't been launched or attached yet. if (m_enable) { - // Save off enabled configuration so we can apply these parsed - // options the next time an attach or launch occurs. + // Save off enabled configuration so we can apply these parsed options + // the next time an attach or launch occurs. DebuggerSP debugger_sp = GetCommandInterpreter().GetDebugger().shared_from_this(); SetGlobalEnableOptions(debugger_sp, m_options_sp); } - // Now check if we have a running process. If so, we should - // instruct the process monitor to enable/disable DarwinLog support - // now. + // Now check if we have a running process. If so, we should instruct the + // process monitor to enable/disable DarwinLog support now. Target *target = GetSelectedOrDummyTarget(); if (!target) { // No target, so there is nothing more to do right now. @@ -833,14 +829,13 @@ // Grab the active process. auto process_sp = target->GetProcessSP(); if (!process_sp) { - // No active process, so there is nothing more to do right - // now. + // No active process, so there is nothing more to do right now. result.SetStatus(eReturnStatusSuccessFinishNoResult); return true; } - // If the process is no longer alive, we can't do this now. - // We'll catch it the next time the process is started up. + // If the process is no longer alive, we can't do this now. We'll catch it + // the next time the process is started up. if (!process_sp->IsAlive()) { result.SetStatus(eReturnStatusSuccessFinishNoResult); return true; @@ -859,19 +854,17 @@ *static_cast(plugin_sp.get()); if (m_enable) { - // Hook up the breakpoint for the process that detects when - // libtrace has been sufficiently initialized to really start - // the os_log stream. This is insurance to assure us that - // logging is really enabled. Requesting that logging be - // enabled for a process before libtrace is initialized - // results in a scenario where no errors occur, but no logging - // is captured, either. This step is to eliminate that - // possibility. + // Hook up the breakpoint for the process that detects when libtrace has + // been sufficiently initialized to really start the os_log stream. This + // is insurance to assure us that logging is really enabled. Requesting + // that logging be enabled for a process before libtrace is initialized + // results in a scenario where no errors occur, but no logging is + // captured, either. This step is to eliminate that possibility. plugin.AddInitCompletionHook(*process_sp.get()); } - // Send configuration to the feature by way of the process. - // Construct the options we will use. + // Send configuration to the feature by way of the process. Construct the + // options we will use. auto config_sp = m_options_sp->BuildConfigurationData(m_enable); const Status error = process_sp->ConfigureStructuredData(GetDarwinLogTypeName(), config_sp); @@ -884,8 +877,8 @@ plugin.SetEnabled(false); } else { result.SetStatus(eReturnStatusSuccessFinishNoResult); - // Our configuration succeeeded, so we're enabled/disabled - // per whichever one this command is setup to do. + // Our configuration succeeeded, so we're enabled/disabled per whichever + // one this command is setup to do. plugin.SetEnabled(m_enable); } return result.Succeeded(); @@ -916,8 +909,8 @@ bool DoExecute(Args &command, CommandReturnObject &result) override { auto &stream = result.GetOutputStream(); - // Figure out if we've got a process. If so, we can tell if - // DarwinLog is available for that process. + // Figure out if we've got a process. If so, we can tell if DarwinLog is + // available for that process. Target *target = GetSelectedOrDummyTarget(); auto process_sp = target ? target->GetProcessSP() : ProcessSP(); if (!target || !process_sp) { @@ -1016,13 +1009,12 @@ EnableOptionsSP ParseAutoEnableOptions(Status &error, Debugger &debugger) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS); - // We are abusing the options data model here so that we can parse - // options without requiring the Debugger instance. + // We are abusing the options data model here so that we can parse options + // without requiring the Debugger instance. - // We have an empty execution context at this point. We only want - // to parse options, and we don't need any context to do this here. - // In fact, we want to be able to parse the enable options before having - // any context. + // We have an empty execution context at this point. We only want to parse + // options, and we don't need any context to do this here. In fact, we want + // to be able to parse the enable options before having any context. ExecutionContext exe_ctx; EnableOptionsSP options_sp(new EnableOptions()); @@ -1047,8 +1039,8 @@ options_property_sp->GetAsString()->GetCurrentValue(); Args args(enable_options); if (args.GetArgumentCount() > 0) { - // Eliminate the initial '--' that would be required to set the - // settings that themselves include '-' and/or '--'. + // Eliminate the initial '--' that would be required to set the settings + // that themselves include '-' and/or '--'. const char *first_arg = args.GetArgumentAtIndex(0); if (first_arg && (strcmp(first_arg, "--") == 0)) args.Shift(); @@ -1172,9 +1164,9 @@ return; } - // Broadcast the structured data event if we have that enabled. - // This is the way that the outside world (all clients) get access - // to this data. This plugin sets policy as to whether we do that. + // Broadcast the structured data event if we have that enabled. This is the + // way that the outside world (all clients) get access to this data. This + // plugin sets policy as to whether we do that. DebuggerSP debugger_sp = process.GetTarget().GetDebugger().shared_from_this(); auto options_sp = GetGlobalEnableOptions(debugger_sp); if (options_sp && options_sp->GetBroadcastEvents()) { @@ -1184,8 +1176,8 @@ process.BroadcastStructuredData(object_sp, shared_from_this()); } - // Later, hang on to a configurable amount of these and allow commands - // to inspect, including showing backtraces. + // Later, hang on to a configurable amount of these and allow commands to + // inspect, including showing backtraces. } static void SetErrorWithJSON(Status &error, const char *message, @@ -1261,8 +1253,8 @@ return false; } - // If we haven't already grabbed the first timestamp - // value, do that now. + // If we haven't already grabbed the first timestamp value, do that + // now. if (!m_recorded_first_timestamp) { uint64_t timestamp = 0; if (event->GetValueForKeyAsInteger("timestamp", timestamp)) { @@ -1300,8 +1292,8 @@ // Check if we should enable the darwin log support on startup/attach. if (!GetGlobalProperties()->GetEnableOnStartup() && !s_is_explicitly_enabled) { - // We're neither auto-enabled or explicitly enabled, so we shouldn't - // try to enable here. + // We're neither auto-enabled or explicitly enabled, so we shouldn't try to + // enable here. if (log) log->Printf("StructuredDataDarwinLog::%s not applicable, we're not " "enabled (process uid %u)", @@ -1321,9 +1313,9 @@ } } - // The logging support module name, specifies the name of - // the image name that must be loaded into the debugged process before - // we can try to enable logging. + // The logging support module name, specifies the name of the image name that + // must be loaded into the debugged process before we can try to enable + // logging. const char *logging_module_cstr = GetGlobalProperties()->GetLoggingModuleName(); if (!logging_module_cstr || (logging_module_cstr[0] == 0)) { @@ -1363,8 +1355,8 @@ return; } - // Time to enqueue the breakpoint so we can wait for logging support - // to be initialized before we try to tap the libtrace stream. + // Time to enqueue the breakpoint so we can wait for logging support to be + // initialized before we try to tap the libtrace stream. AddInitCompletionHook(process); if (log) log->Printf("StructuredDataDarwinLog::%s post-init hook breakpoint " @@ -1372,13 +1364,13 @@ __FUNCTION__, logging_module_name.AsCString(), process.GetUniqueID()); - // We need to try the enable here as well, which will succeed - // in the event that we're attaching to (rather than launching) the - // process and the process is already past initialization time. In that - // case, the completion breakpoint will never get hit and therefore won't - // start that way. It doesn't hurt much beyond a bit of bandwidth - // if we end up doing this twice. It hurts much more if we don't get - // the logging enabled when the user expects it. + // We need to try the enable here as well, which will succeed in the event + // that we're attaching to (rather than launching) the process and the + // process is already past initialization time. In that case, the completion + // breakpoint will never get hit and therefore won't start that way. It + // doesn't hurt much beyond a bit of bandwidth if we end up doing this twice. + // It hurts much more if we don't get the logging enabled when the user + // expects it. EnableNow(); } @@ -1415,8 +1407,7 @@ StructuredDataPluginSP StructuredDataDarwinLog::CreateInstance(Process &process) { - // Currently only Apple targets support the os_log/os_activity - // protocol. + // Currently only Apple targets support the os_log/os_activity protocol. if (process.GetTarget().GetArchitecture().GetTriple().getVendor() == llvm::Triple::VendorType::Apple) { auto process_wp = ProcessWP(process.shared_from_this()); @@ -1463,20 +1454,20 @@ Target *target) { Status error; - // If we're not debugging this launched process, there's nothing for us - // to do here. + // If we're not debugging this launched process, there's nothing for us to do + // here. if (!launch_info.GetFlags().AnySet(eLaunchFlagDebug)) return error; // Darwin os_log() support automatically adds debug-level and info-level // messages when a debugger is attached to a process. However, with - // integrated suppport for debugging built into the command-line LLDB, - // the user may specifically set to *not* include debug-level and info-level - // content. When the user is using the integrated log support, we want - // to put the kabosh on that automatic adding of info and debug level. - // This is done by adding an environment variable to the process on launch. - // (This also means it is not possible to suppress this behavior if - // attaching to an already-running app). + // integrated suppport for debugging built into the command-line LLDB, the + // user may specifically set to *not* include debug-level and info-level + // content. When the user is using the integrated log support, we want to + // put the kabosh on that automatic adding of info and debug level. This is + // done by adding an environment variable to the process on launch. (This + // also means it is not possible to suppress this behavior if attaching to an + // already-running app). // Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); // If the target architecture is not one that supports DarwinLog, we have @@ -1487,20 +1478,19 @@ return error; } - // If DarwinLog is not enabled (either by explicit user command or via - // the auto-enable option), then we have nothing to do. + // If DarwinLog is not enabled (either by explicit user command or via the + // auto-enable option), then we have nothing to do. if (!GetGlobalProperties()->GetEnableOnStartup() && !s_is_explicitly_enabled) { // Nothing to do, DarwinLog is not enabled. return error; } - // If we don't have parsed configuration info, that implies we have - // enable-on-startup set up, but we haven't yet attempted to run the - // enable command. + // If we don't have parsed configuration info, that implies we have enable- + // on-startup set up, but we haven't yet attempted to run the enable command. if (!target) { - // We really can't do this without a target. We need to be able - // to get to the debugger to get the proper options to do this right. + // We really can't do this without a target. We need to be able to get to + // the debugger to get the proper options to do this right. // TODO log. error.SetErrorString("requires a target to auto-enable DarwinLog."); return error; @@ -1513,28 +1503,28 @@ if (!options_sp || !error.Success()) return error; - // We already parsed the options, save them now so we don't generate - // them again until the user runs the command manually. + // We already parsed the options, save them now so we don't generate them + // again until the user runs the command manually. SetGlobalEnableOptions(debugger_sp, options_sp); } if (!options_sp->GetEchoToStdErr()) { - // The user doesn't want to see os_log/NSLog messages echo to stderr. - // That mechanism is entirely separate from the DarwinLog support. - // By default we don't want to get it via stderr, because that would - // be in duplicate of the explicit log support here. + // The user doesn't want to see os_log/NSLog messages echo to stderr. That + // mechanism is entirely separate from the DarwinLog support. By default we + // don't want to get it via stderr, because that would be in duplicate of + // the explicit log support here. // Here we need to strip out any OS_ACTIVITY_DT_MODE setting to prevent // echoing of os_log()/NSLog() to stderr in the target program. launch_info.GetEnvironment().erase("OS_ACTIVITY_DT_MODE"); - // We will also set the env var that tells any downstream launcher - // from adding OS_ACTIVITY_DT_MODE. + // We will also set the env var that tells any downstream launcher from + // adding OS_ACTIVITY_DT_MODE. launch_info.GetEnvironment()["IDE_DISABLED_OS_ACTIVITY_DT_MODE"] = "1"; } - // Set the OS_ACTIVITY_MODE env var appropriately to enable/disable - // debug and info level messages. + // Set the OS_ACTIVITY_MODE env var appropriately to enable/disable debug and + // info level messages. const char *env_var_value; if (options_sp->GetIncludeDebugLevel()) env_var_value = "debug"; @@ -1553,8 +1543,8 @@ lldb::user_id_t break_loc_id) { // We hit the init function. We now want to enqueue our new thread plan, // which will in turn enqueue a StepOut thread plan. When the StepOut - // finishes and control returns to our new thread plan, that is the time - // when we can execute our logic to enable the logging support. + // finishes and control returns to our new thread plan, that is the time when + // we can execute our logic to enable the logging support. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) @@ -1613,8 +1603,8 @@ process_uid); return; } - // Make sure we only call it once, just in case the - // thread plan hits the breakpoint twice. + // Make sure we only call it once, just in case the thread plan hits + // the breakpoint twice. if (!called_enable_method) { if (log) log->Printf("StructuredDataDarwinLog::post-init callback: " @@ -1624,8 +1614,8 @@ ->EnableNow(); called_enable_method = true; } else { - // Our breakpoint was hit more than once. Unexpected but - // no harm done. Log it. + // Our breakpoint was hit more than once. Unexpected but no harm + // done. Log it. if (log) log->Printf("StructuredDataDarwinLog::post-init callback: " "skipping EnableNow(), already called by " @@ -1682,8 +1672,8 @@ m_added_breakpoint = true; } - // Set a breakpoint for the process that will kick in when libtrace - // has finished its initialization. + // Set a breakpoint for the process that will kick in when libtrace has + // finished its initialization. Target &target = process.GetTarget(); // Build up the module list. @@ -1788,8 +1778,8 @@ if (header_count > 0) stream.PutChar(','); - // Display the activity chain, from parent-most to child-most - // activity, separated by a colon (:). + // Display the activity chain, from parent-most to child-most activity, + // separated by a colon (:). stream.PutCString("activity-chain="); stream.PutCString(activity_chain); ++header_count; @@ -1831,8 +1821,8 @@ // Check the type of the event. ConstString event_type; if (!event.GetValueForKeyAsString("type", event_type)) { - // Hmm, we expected to get events that describe - // what they are. Continue anyway. + // Hmm, we expected to get events that describe what they are. Continue + // anyway. return 0; } @@ -1880,10 +1870,10 @@ log->Printf("StructuredDataDarwinLog::%s() call is for process uid %u", __FUNCTION__, process_sp->GetUniqueID()); - // If we have configuration data, we can directly enable it now. - // Otherwise, we need to run through the command interpreter to parse - // the auto-run options (which is the only way we get here without having - // already-parsed configuration data). + // If we have configuration data, we can directly enable it now. Otherwise, + // we need to run through the command interpreter to parse the auto-run + // options (which is the only way we get here without having already-parsed + // configuration data). DebuggerSP debugger_sp = process_sp->GetTarget().GetDebugger().shared_from_this(); if (!debugger_sp) { @@ -1896,8 +1886,8 @@ auto options_sp = GetGlobalEnableOptions(debugger_sp); if (!options_sp) { - // We haven't run the enable command yet. Just do that now, it'll - // take care of the rest. + // We haven't run the enable command yet. Just do that now, it'll take + // care of the rest. auto &interpreter = debugger_sp->GetCommandInterpreter(); const bool success = RunEnableCommand(interpreter); if (log) { @@ -1920,8 +1910,8 @@ return; } - // We've previously been enabled. We will re-enable now with the - // previously specified options. + // We've previously been enabled. We will re-enable now with the previously + // specified options. auto config_sp = options_sp->BuildConfigurationData(true); if (!config_sp) { if (log) Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -106,9 +106,9 @@ bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const { if (IsValid()) { - // This bitfield info is valid, so any subsequent bitfields - // must not overlap and must be at a higher bit offset than - // any previous bitfield + size. + // This bitfield info is valid, so any subsequent bitfields must not + // overlap and must be at a higher bit offset than any previous bitfield + // + size. return (bit_size + bit_offset) <= next_bit_offset; } else { // If the this BitfieldInfo is not valid, then any offset isOK @@ -152,8 +152,8 @@ if (!isClangModuleFwdDecl(die)) return TypeSP(); - // Since this this type is defined in one of the Clang modules - // imported by this symbol file, search all of them. + // Since this this type is defined in one of the Clang modules imported by + // this symbol file, search all of them. auto *SymFile = die.GetCU()->GetSymbolFileDWARF(); for (const auto &NameModule : SymFile->getExternalTypeModules()) { if (!NameModule.second) @@ -168,9 +168,8 @@ if (num_dwo_types != 1) return TypeSP(); - // We found a real definition for this type in the Clang module, so - // lets use it and cache the fact that we found a complete type for - // this die. + // We found a real definition for this type in the Clang module, so lets use + // it and cache the fact that we found a complete type for this die. TypeSP dwo_type_sp = dwo_types.GetTypeAtIndex(0); if (!dwo_type_sp) return TypeSP(); @@ -211,8 +210,7 @@ if (!tag_decl_ctx) return; - // If this type was not imported from an external AST, there's - // nothing to do. + // If this type was not imported from an external AST, there's nothing to do. CompilerType type = ClangASTContext::GetTypeForDecl(tag_decl_ctx); if (!type || !ast_importer.CanImport(type)) return; @@ -223,8 +221,8 @@ "Unable to complete the Decl context for DIE '%s' at offset " "0x%8.8x.\nPlease file a bug report.", type_name_cstr ? type_name_cstr : "", die.GetOffset()); - // We need to make the type look complete otherwise, we - // might crash in Clang when adding children. + // We need to make the type look complete otherwise, we might crash in + // Clang when adding children. if (ClangASTContext::StartTagDeclarationDefinition(type)) ClangASTContext::CompleteTagDeclarationDefinition(type); } @@ -312,8 +310,7 @@ type_name_cstr = form_value.AsCString(); // Work around a bug in llvm-gcc where they give a name to a - // reference type which doesn't - // include the "&"... + // reference type which doesn't include the "&"... if (tag == DW_TAG_reference_type) { if (strchr(type_name_cstr, '&') == NULL) type_name_cstr = NULL; @@ -339,32 +336,32 @@ } if (tag == DW_TAG_typedef && encoding_uid.IsValid()) { - // Try to parse a typedef from the DWO file first as modules - // can contain typedef'ed structures that have no names like: + // Try to parse a typedef from the DWO file first as modules can + // contain typedef'ed structures that have no names like: // // typedef struct { int a; } Foo; // - // In this case we will have a structure with no name and a - // typedef named "Foo" that points to this unnamed structure. - // The name in the typedef is the only identifier for the struct, - // so always try to get typedefs from DWO files if possible. + // In this case we will have a structure with no name and a typedef + // named "Foo" that points to this unnamed structure. The name in the + // typedef is the only identifier for the struct, so always try to + // get typedefs from DWO files if possible. // - // The type_sp returned will be empty if the typedef doesn't exist - // in a DWO file, so it is cheap to call this function just to check. + // The type_sp returned will be empty if the typedef doesn't exist in + // a DWO file, so it is cheap to call this function just to check. // - // If we don't do this we end up creating a TypeSP that says this - // is a typedef to type 0x123 (the DW_AT_type value would be 0x123 - // in the DW_TAG_typedef), and this is the unnamed structure type. - // We will have a hard time tracking down an unnammed structure - // type in the module DWO file, so we make sure we don't get into - // this situation by always resolving typedefs from the DWO file. + // If we don't do this we end up creating a TypeSP that says this is + // a typedef to type 0x123 (the DW_AT_type value would be 0x123 in + // the DW_TAG_typedef), and this is the unnamed structure type. We + // will have a hard time tracking down an unnammed structure type in + // the module DWO file, so we make sure we don't get into this + // situation by always resolving typedefs from the DWO file. const DWARFDIE encoding_die = dwarf->GetDIE(DIERef(encoding_uid)); - // First make sure that the die that this is typedef'ed to _is_ - // just a declaration (DW_AT_declaration == 1), not a full definition + // First make sure that the die that this is typedef'ed to _is_ just + // a declaration (DW_AT_declaration == 1), not a full definition // since template types can't be represented in modules since only - // concrete instances of templates are ever emitted and modules - // won't contain those + // concrete instances of templates are ever emitted and modules won't + // contain those if (encoding_die && encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { @@ -563,10 +560,9 @@ case DW_AT_decl_file: if (die.GetCU()->DW_AT_decl_file_attributes_are_invalid()) { // llvm-gcc outputs invalid DW_AT_decl_file attributes that - // always - // point to the compile unit file, so we clear this invalid - // value - // so that we can still unique types efficiently. + // always point to the compile unit file, so we clear this + // invalid value so that we can still unique types + // efficiently. decl.SetFile(FileSpec("", false)); } else decl.SetFile( @@ -625,10 +621,10 @@ } } - // UniqueDWARFASTType is large, so don't create a local variables on the - // stack, put it on the heap. This function is often called recursively - // and clang isn't good and sharing the stack space for variables in - // different blocks. + // UniqueDWARFASTType is large, so don't create a local variables on + // the stack, put it on the heap. This function is often called + // recursively and clang isn't good and sharing the stack space for + // variables in different blocks. std::unique_ptr unique_ast_entry_ap( new UniqueDWARFASTType()); @@ -639,10 +635,8 @@ LanguageType die_language = die.GetLanguage(); if (Language::LanguageIsCPlusPlus(die_language)) { // For C++, we rely solely upon the one definition rule that says - // only - // one thing can exist at a given decl context. We ignore the file - // and - // line that things are declared on. + // only one thing can exist at a given decl context. We ignore the + // file and line that things are declared on. std::string qualified_name; if (die.GetQualifiedName(qualified_name)) unique_typename = ConstString(qualified_name); @@ -679,17 +673,16 @@ if (byte_size_valid && byte_size == 0 && type_name_cstr && die.HasChildren() == false && sc.comp_unit->GetLanguage() == eLanguageTypeObjC) { - // Work around an issue with clang at the moment where - // forward declarations for objective C classes are emitted - // as: + // Work around an issue with clang at the moment where forward + // declarations for objective C classes are emitted as: // DW_TAG_structure_type [2] // DW_AT_name( "ForwardObjcClass" ) // DW_AT_byte_size( 0x00 ) // DW_AT_decl_file( "..." ) // DW_AT_decl_line( 1 ) // - // Note that there is no DW_AT_declaration and there are - // no children, and the byte size is zero. + // Note that there is no DW_AT_declaration and there are no children, + // and the byte size is zero. is_forward_declaration = true; } @@ -697,11 +690,11 @@ class_language == eLanguageTypeObjC_plus_plus) { if (!is_complete_objc_class && die.Supports_DW_AT_APPLE_objc_complete_type()) { - // We have a valid eSymbolTypeObjCClass class symbol whose - // name matches the current objective C class that we - // are trying to find and this DIE isn't the complete - // definition (we checked is_complete_objc_class above and - // know it is false), so the real definition is in here somewhere + // We have a valid eSymbolTypeObjCClass class symbol whose name + // matches the current objective C class that we are trying to find + // and this DIE isn't the complete definition (we checked + // is_complete_objc_class above and know it is false), so the real + // definition is in here somewhere type_sp = dwarf->FindCompleteObjCDefinitionTypeForDIE( die, type_name_const_str, true); @@ -709,9 +702,8 @@ SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, + // see if we have a declaration anywhere else... type_sp = debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE( die, type_name_const_str, true); @@ -728,9 +720,9 @@ 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 + // 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 dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); return type_sp; } @@ -738,11 +730,11 @@ } if (is_forward_declaration) { - // We have a forward declaration to a type and we need - // to try and find a full declaration. We look in the - // current type index just in case we have a forward - // declaration followed by an actual declarations in the - // DWARF. If this fails, we need to look elsewhere... + // We have a forward declaration to a type and we need to try and + // find a full declaration. We look in the current type index just in + // case we have a forward declaration followed by an actual + // declarations in the DWARF. If this fails, we need to look + // elsewhere... if (log) { dwarf->GetObjectFile()->GetModule()->LogMessage( log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a " @@ -768,9 +760,8 @@ SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, see + // if we have a declaration anywhere else... type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext( die_decl_ctx); @@ -786,9 +777,8 @@ 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 + // 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 dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE( dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID(), dwarf))); @@ -805,18 +795,17 @@ clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE(die, nullptr); - // If your decl context is a record that was imported from - // another AST context (in the gmodules case), we need to - // make sure the type backing the Decl is complete before - // adding children to it. This is not an issue in the - // non-gmodules case because the debug info will always contain - // a full definition of parent types in that case. + // If your decl context is a record that was imported from another + // AST context (in the gmodules case), we need to make sure the type + // backing the Decl is complete before adding children to it. This is + // not an issue in the non-gmodules case because the debug info will + // always contain a full definition of parent types in that case. CompleteExternalTagDeclType(GetClangASTImporter(), decl_ctx, die, type_name_cstr); if (accessibility == eAccessNone && decl_ctx) { - // Check the decl context that contains this class/struct/union. - // If it is a class we must give it an accessibility. + // Check the decl context that contains this class/struct/union. If + // it is a class we must give it an accessibility. const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind(); if (DeclKindIsCXXClass(containing_decl_kind)) @@ -868,8 +857,8 @@ } // Store a forward declaration to this class type in case any - // parameters in any class methods need it for the clang - // types for function prototypes. + // parameters in any class methods need it for the clang types for + // function prototypes. LinkDeclContextToDIE(m_ast.GetDeclContextForType(clang_type), die); type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str, byte_size, NULL, LLDB_INVALID_UID, @@ -878,9 +867,9 @@ type_sp->SetIsCompleteObjCClass(is_complete_objc_class); - // Add our type to the unique type map so we don't - // end up creating many copies of the same type over - // and over in the ASTContext for our module + // Add our type to the unique type map so we don't end up creating many + // copies of the same type over and over in the ASTContext for our + // module unique_ast_entry_ap->m_type_sp = type_sp; unique_ast_entry_ap->m_die = die; unique_ast_entry_ap->m_declaration = unique_decl; @@ -892,8 +881,7 @@ // Check to see if the DIE actually has a definition, some version of // GCC will // emit DIEs with DW_AT_declaration set to true, but yet still have - // subprogram, - // members, or inheritance, so we can't trust it + // subprogram, members, or inheritance, so we can't trust it DWARFDIE child_die = die.GetFirstChild(); while (child_die) { switch (child_die.Tag()) { @@ -917,10 +905,10 @@ } if (!is_forward_declaration) { - // Always start the definition for a class type so that - // if the class has child classes or types that require - // the class to be created for use as their decl contexts - // the class will be ready to accept these child definitions. + // Always start the definition for a class type so that if the class + // has child classes or types that require the class to be created + // for use as their decl contexts the class will be ready to accept + // these child definitions. if (die.HasChildren() == false) { // No children for this struct/union/class, lets finish it if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { @@ -944,33 +932,30 @@ } } } else if (clang_type_was_created) { - // Start the definition if the class is not objective C since - // the underlying decls respond to isCompleteDefinition(). Objective + // Start the definition if the class is not objective C since the + // underlying decls respond to isCompleteDefinition(). Objective // C decls don't respond to isCompleteDefinition() so we can't // start the declaration definition right away. For C++ - // class/union/structs - // 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.. + // class/union/structs 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) ClangASTContext::StartTagDeclarationDefinition(clang_type); - // Leave this as a forward declaration until we need - // to know the details of the type. lldb_private::Type - // will automatically call the SymbolFile virtual function - // "SymbolFileDWARF::CompleteType(Type *)" - // When the definition needs to be defined. + // Leave this as a forward declaration until we need to know the + // details of the type. lldb_private::Type will automatically call + // the SymbolFile virtual function + // "SymbolFileDWARF::CompleteType(Type *)" When the definition + // needs to be defined. assert(!dwarf->GetForwardDeclClangTypeToDie().count( ClangUtil::RemoveFastQualifiers(clang_type) .GetOpaqueQualType()) && "Type already in the forward declaration map!"); - // Can't assume m_ast.GetSymbolFile() is actually a SymbolFileDWARF, - // it can be a - // SymbolFileDWARFDebugMap for Apple binaries. + // Can't assume m_ast.GetSymbolFile() is actually a + // SymbolFileDWARF, it can be a SymbolFileDWARFDebugMap for Apple + // binaries. dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] = clang_type.GetOpaqueQualType(); dwarf->GetForwardDeclClangTypeToDie() @@ -980,11 +965,10 @@ } } - // If we made a clang type, set the trivial abi if applicable: - // We only do this for pass by value - which implies the Trivial ABI. - // There isn't a way to assert that something that would normally be - // pass by value is pass by reference, so we ignore that attribute if - // set. + // If we made a clang type, set the trivial abi if applicable: We only + // do this for pass by value - which implies the Trivial ABI. There + // isn't a way to assert that something that would normally be pass by + // value is pass by reference, so we ignore that attribute if set. if (calling_convention == llvm::dwarf::DW_CC_pass_by_value) { clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType()); @@ -1070,9 +1054,8 @@ SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, + // see if we have a declaration anywhere else... type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext( die_decl_ctx); @@ -1089,9 +1072,9 @@ 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 + // 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 dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(dwarf->DebugInfo()->GetDIE( @@ -1317,8 +1300,8 @@ bool is_cxx_method = DeclKindIsCXXClass(containing_decl_kind); // Start off static. This will be set to false in - // ParseChildParameters(...) - // if we find a "this" parameters as the first parameter + // ParseChildParameters(...) if we find a "this" parameters as the + // first parameter if (is_cxx_method) { is_static = true; } @@ -1333,25 +1316,22 @@ bool ignore_containing_context = false; // Check for templatized class member functions. If we had any - // DW_TAG_template_type_parameter - // or DW_TAG_template_value_parameter the DW_TAG_subprogram DIE, then we - // can't let this become - // a method in a class. Why? Because templatized functions are only - // emitted if one of the - // templatized methods is used in the current compile unit and we will - // end up with classes - // that may or may not include these member functions and this means one - // class won't match another - // class definition and it affects our ability to use a class in the - // clang expression parser. So - // for the greater good, we currently must not allow any template member - // functions in a class definition. + // DW_TAG_template_type_parameter or DW_TAG_template_value_parameter + // the DW_TAG_subprogram DIE, then we can't let this become a method in + // a class. Why? Because templatized functions are only emitted if one + // of the templatized methods is used in the current compile unit and + // we will end up with classes that may or may not include these member + // functions and this means one class won't match another class + // definition and it affects our ability to use a class in the clang + // expression parser. So for the greater good, we currently must not + // allow any template member functions in a class definition. if (is_cxx_method && has_template_params) { ignore_containing_context = true; is_cxx_method = false; } - // clang_type will get the function prototype clang type after this call + // clang_type will get the function prototype clang type after this + // call clang_type = m_ast.CreateFunctionType( return_clang_type, function_param_types.data(), function_param_types.size(), is_variadic, type_quals); @@ -1379,8 +1359,7 @@ if (class_opaque_type) { // If accessibility isn't set to anything valid, assume public - // for - // now... + // for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; @@ -1402,9 +1381,8 @@ } } } else if (is_cxx_method) { - // Look at the parent of this DIE and see if is is - // a class or struct and see if this is actually a - // C++ method + // Look at the parent of this DIE and see if is is a class or + // struct and see if this is actually a C++ method Type *class_type = dwarf->ResolveType(decl_ctx_die); if (class_type) { bool alternate_defn = false; @@ -1413,10 +1391,8 @@ alternate_defn = true; // We uniqued the parent class of this function to another - // class - // so we now need to associate all dies under "decl_ctx_die" - // to - // DIEs in the DIE for "class_type"... + // class so we now need to associate all dies under + // "decl_ctx_die" to DIEs in the DIE for "class_type"... SymbolFileDWARF *class_symfile = NULL; DWARFDIE class_type_die; @@ -1442,10 +1418,8 @@ // 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... + // don't like having stuff added to them after their + // definitions are complete... type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { @@ -1457,16 +1431,13 @@ if (specification_die_form.IsValid()) { // We have a specification which we are going to base our - // function - // prototype off of, so we need this type to be completed so - // that the - // m_die_to_decl_ctx for the method in the specification has a - // valid - // clang decl context. + // function prototype off of, so we need this type to be + // completed so that the m_die_to_decl_ctx for the method in + // the specification has a valid clang decl context. class_type->GetForwardCompilerType(); // If we have a specification, then the function type should - // have been - // made with the specification and not with this die. + // have been made with the specification and not with this + // die. DWARFDIE spec_die = dwarf->DebugInfo()->GetDIE( DIERef(specification_die_form)); clang::DeclContext *spec_clang_decl_ctx = @@ -1482,12 +1453,9 @@ type_handled = true; } else if (abstract_origin_die_form.IsValid()) { // We have a specification which we are going to base our - // function - // prototype off of, so we need this type to be completed so - // that the - // m_die_to_decl_ctx for the method in the abstract origin has - // a valid - // clang decl context. + // function prototype off of, so we need this type to be + // completed so that the m_die_to_decl_ctx for the method in + // the abstract origin has a valid clang decl context. class_type->GetForwardCompilerType(); DWARFDIE abs_die = dwarf->DebugInfo()->GetDIE( @@ -1510,17 +1478,16 @@ if (class_opaque_type.IsBeingDefined() || alternate_defn) { if (!is_static && !die.HasChildren()) { // We have a C++ member function with no children (this - // pointer!) - // and clang will get mad if we try and make a function - // that isn't - // well formed in the DWARF, so we will just skip it... + // pointer!) and clang will get mad if we try and make + // a function that isn't well formed in the DWARF, so + // we will just skip it... type_handled = true; } else { bool add_method = true; if (alternate_defn) { // If an alternate definition for the class exists, - // then add the method only if an - // equivalent is not already present. + // then add the method only if an equivalent is not + // already present. clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl( class_opaque_type.GetOpaqueQualType()); @@ -1560,9 +1527,8 @@ const bool is_attr_used = false; // Neither GCC 4.2 nor clang++ currently set a valid - // accessibility - // in the DWARF for C++ methods... Default to public - // for now... + // accessibility in the DWARF for C++ methods... + // Default to public for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; @@ -1603,25 +1569,21 @@ } } else { // We were asked to parse the type for a method in a - // class, yet the - // class hasn't been asked to complete itself through the - // clang::ExternalASTSource protocol, so we need to just - // have the - // class complete itself and do things the right way, then - // our + // class, yet the class hasn't been asked to complete + // itself through the clang::ExternalASTSource protocol, + // so we need to just have the class complete itself and + // do things the right way, then our // DIE should then have an entry in the // dwarf->GetDIEToType() map. First // we need to modify the dwarf->GetDIEToType() so it - // doesn't think we are - // trying to parse this DIE anymore... + // doesn't think we are trying to parse this DIE + // anymore... dwarf->GetDIEToType()[die.GetDIE()] = 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). + // complete itself using the clang::ExternalASTSource + // protocol which will parse all base classes and all + // methods (including the method for this DIE). class_type->GetFullCompilerType(); // The type for this DIE should have been filled in the @@ -1635,8 +1597,7 @@ // 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. - // + // itself. type_handled = true; } } @@ -1821,11 +1782,10 @@ } // We have no choice other than to pretend that the element class - // type - // is complete. If we don't do this, clang will crash when trying - // to layout the class. Since we provide layout assistance, all - // ivars in this class and other classes will be fine, this is - // the best we can do short of crashing. + // type is complete. If we don't do this, clang will crash when + // trying to layout the class. Since we provide layout + // assistance, all ivars in this class and other classes will be + // fine, this is the best we can do short of crashing. if (ClangASTContext::StartTagDeclarationDefinition( array_element_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -2148,9 +2108,9 @@ return template_param_infos.args.size() == template_param_infos.names.size(); } -// Checks whether m1 is an overload of m2 (as opposed to an override). -// This is called by addOverridesForMethod to distinguish overrides (which share -// a vtable entry) from overloads (which require distinct entries). +// Checks whether m1 is an overload of m2 (as opposed to an override). This is +// called by addOverridesForMethod to distinguish overrides (which share a +// vtable entry) from overloads (which require distinct entries). static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) { // FIXME: This should detect covariant return types, but currently doesn't. lldbassert(&m1->getASTContext() == &m2->getASTContext() && @@ -2179,8 +2139,8 @@ } // If decl is a virtual method, walk the base classes looking for methods that -// decl overrides. This table of overridden methods is used by IRGen to determine -// the vtable layout for decl's parent class. +// decl overrides. This table of overridden methods is used by IRGen to +// determine the vtable layout for decl's parent class. static void addOverridesForMethod(clang::CXXMethodDecl *decl) { if (!decl->isVirtual()) return; @@ -2254,10 +2214,10 @@ #if defined LLDB_CONFIGURATION_DEBUG //---------------------------------------------------------------------- - // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES - // environment variable can be set with one or more typenames separated - // by ';' characters. This will cause this function to not complete any - // types whose names match. + // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment + // variable can be set with one or more typenames separated by ';' + // characters. This will cause this function to not complete any types whose + // names match. // // Examples of setting this environment variable: // @@ -2308,8 +2268,8 @@ LanguageType class_language = eLanguageTypeUnknown; if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) { class_language = eLanguageTypeObjC; - // For objective C we don't start the definition when - // the class is created. + // For objective C we don't start the definition when the class is + // created. ClangASTContext::StartTagDeclarationDefinition(clang_type); } @@ -2381,29 +2341,27 @@ 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. - // When we parsed the child members we tracked that actual - // accessibility value for each DW_TAG_member in the - // "member_accessibilities" array. If the value for the - // member is zero, then it was set to the "default_accessibility" - // which for structs was "public". Below we correct this - // by setting any fields to "private" that weren't correctly - // set. + // 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. When we parsed the child + // members we tracked that actual accessibility value for each + // DW_TAG_member in the "member_accessibilities" array. If the value + // for the member is zero, then it was set to the + // "default_accessibility" which for structs was "public". Below we + // correct this by setting any fields to "private" that weren't + // correctly set. if (is_a_class && !member_accessibilities.empty()) { - // This is a class and all members that didn't have - // their access specified are private. + // This is a class and all members that didn't have their access + // specified are private. m_ast.SetDefaultAccessForRecordFields( m_ast.GetAsRecordDecl(clang_type), eAccessPrivate, &member_accessibilities.front(), member_accessibilities.size()); } if (!base_classes.empty()) { - // Make sure all base classes refer to complete types and not - // forward declarations. If we don't do this, clang will crash - // with an assertion in the call to - // clang_type.SetBaseClassesForClassType() + // Make sure all base classes refer to complete types and not forward + // declarations. If we don't do this, clang will crash with an + // assertion in the call to clang_type.SetBaseClassesForClassType() for (auto &base_class : base_classes) { clang::TypeSourceInfo *type_source_info = base_class->getTypeSourceInfo(); @@ -2423,11 +2381,10 @@ // We have no choice other than to pretend that the base class // is complete. If we don't do this, clang will crash when we // call setBases() inside of - // "clang_type.SetBaseClassesForClassType()" - // below. Since we provide layout assistance, all ivars in this - // class and other classes will be fine, this is the best we can - // do - // short of crashing. + // "clang_type.SetBaseClassesForClassType()" below. Since we + // provide layout assistance, all ivars in this class and other + // classes will be fine, this is the best we can do short of + // crashing. if (ClangASTContext::StartTagDeclarationDefinition( base_class_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -2440,8 +2397,8 @@ &base_classes.front(), base_classes.size()); - // Clang will copy each CXXBaseSpecifier in "base_classes" - // so we have to free them all. + // Clang will copy each CXXBaseSpecifier in "base_classes" so we have + // to free them all. ClangASTContext::DeleteBaseClassSpecifiers(&base_classes.front(), base_classes.size()); } @@ -2751,10 +2708,8 @@ Language::LanguageIsCPlusPlus(die.GetLanguage()) && name && strcmp(name, "main") != 0) { // If the mangled name is not present in the DWARF, generate the - // demangled name - // using the decl context. We skip if the function is "main" as its name - // is - // never mangled. + // demangled name using the decl context. We skip if the function is + // "main" as its name is never mangled. bool is_static = false; bool is_variadic = false; bool has_template_params = false; @@ -2928,8 +2883,8 @@ } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; @@ -2971,8 +2926,8 @@ ConstString fixed_getter; ConstString fixed_setter; - // Check if the property getter/setter were provided as full - // names. We want basenames, so we extract them. + // Check if the property getter/setter were provided as full names. + // We want basenames, so we extract them. if (prop_getter_name && prop_getter_name[0] == '-') { ObjCLanguage::MethodName prop_getter_method(prop_getter_name, true); @@ -2984,8 +2939,7 @@ prop_setter_name = prop_setter_method.GetSelector().GetCString(); } - // If the names haven't been provided, they need to be - // filled in. + // If the names haven't been provided, they need to be filled in. if (!prop_getter_name) { prop_getter_name = prop_name; @@ -3001,19 +2955,18 @@ } } - // Clang has a DWARF generation bug where sometimes it - // represents fields that are references with bad byte size - // and bit size/offset information such as: + // Clang has a DWARF generation bug where sometimes it represents + // fields that are references with bad byte size and bit size/offset + // information such as: // // DW_AT_byte_size( 0x00 ) // DW_AT_bit_size( 0x40 ) // DW_AT_bit_offset( 0xffffffffffffffc0 ) // - // So check the bit offset to make sure it is sane, and if - // the values are not sane, remove them. If we don't do this - // then we will end up with a crash if we try to use this - // type in an expression when clang becomes unhappy with its - // recycled debug info. + // So check the bit offset to make sure it is sane, and if the values + // are not sane, remove them. If we don't do this then we will end up + // with a crash if we try to use this type in an expression when clang + // becomes unhappy with its recycled debug info. if (byte_size == 0 && bit_offset < 0) { bit_size = 0; @@ -3027,12 +2980,10 @@ if (member_idx == 0 && !is_artificial && name && (strstr(name, "_vptr$") == name)) { - // Not all compilers will mark the vtable pointer - // member as artificial (llvm-gcc). We can't have - // the virtual members in our classes otherwise it - // throws off all child offsets since we end up - // having and extra pointer sized member in our - // class layouts. + // Not all compilers will mark the vtable pointer member as + // artificial (llvm-gcc). We can't have the virtual members in our + // classes otherwise it throws off all child offsets since we end up + // having and extra pointer sized member in our class layouts. is_artificial = true; } @@ -3072,15 +3023,15 @@ ///////////////////////////////////////////////////////////// // How to locate a field given the DWARF debug information // - // AT_byte_size indicates the size of the word in which the - // bit offset must be interpreted. + // AT_byte_size indicates the size of the word in which the bit + // offset must be interpreted. // // AT_data_member_location indicates the byte offset of the // word from the base address of the structure. // // AT_bit_offset indicates how many bits into the word - // (according to the host endianness) the low-order bit of - // the field starts. AT_bit_offset can be negative. + // (according to the host endianness) the low-order bit of the + // field starts. AT_bit_offset can be negative. // // AT_bit_size indicates the size of the field in bits. ///////////////////////////////////////////////////////////// @@ -3121,12 +3072,9 @@ field_bit_offset = this_field_info.bit_offset; // If the member to be emitted did not start on a character - // boundary and there is - // empty space between the last field and this one, then we need - // to emit an - // anonymous member filling up the space up to its start. There - // are three cases - // here: + // boundary and there is empty space between the last field and + // this one, then we need to emit an anonymous member filling + // up the space up to its start. There are three cases here: // // 1 If the previous member ended on a character boundary, then // we can emit an @@ -3151,10 +3099,8 @@ const uint64_t word_width = 32; // Objective-C has invalid DW_AT_bit_offset values in older - // versions - // of clang, so we have to be careful and only insert unnamed - // bitfields - // if we have a new enough clang. + // versions of clang, so we have to be careful and only insert + // unnamed bitfields if we have a new enough clang. bool detect_unnamed_bitfields = true; if (class_language == eLanguageTypeObjC || @@ -3217,10 +3163,10 @@ { // Older versions of clang emit array[0] and array[1] in the - // same way (). - // If the current field is at the end of the structure, then - // there is definitely no room for extra - // elements and we override the type to array[0]. + // same way (). If the current field + // is at the end of the structure, then there is definitely no + // room for extra elements and we override the type to + // array[0]. CompilerType member_array_element_type; uint64_t member_array_size; @@ -3272,12 +3218,11 @@ die.GetOffset(), name, sc.comp_unit ? sc.comp_unit->GetPath().c_str() : "the source file"); - // We have no choice other than to pretend that the member class - // is complete. If we don't do this, clang will crash when - // trying - // to layout the class. Since we provide layout assistance, all - // ivars in this class and other classes will be fine, this is - // the best we can do short of crashing. + // We have no choice other than to pretend that the member + // class is complete. If we don't do this, clang will crash + // when trying to layout the class. Since we provide layout + // assistance, all ivars in this class and other classes will + // be fine, this is the best we can do short of crashing. if (ClangASTContext::StartTagDeclarationDefinition( member_clang_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -3399,8 +3344,8 @@ } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; @@ -3446,18 +3391,16 @@ if (is_virtual) { // Do not specify any offset for virtual inheritance. The DWARF - // produced by clang doesn't - // give us a constant offset, but gives us a DWARF expressions that - // requires an actual object - // in memory. the DW_AT_data_member_location for a virtual base - // class looks like: + // produced by clang doesn't give us a constant offset, but gives + // us a DWARF expressions that requires an actual object in memory. + // the DW_AT_data_member_location for a virtual base class looks + // like: // DW_AT_data_member_location( DW_OP_dup, DW_OP_deref, // DW_OP_constu(0x00000018), DW_OP_minus, DW_OP_deref, // DW_OP_plus ) // Given this, there is really no valid response we can give to - // clang for virtual base - // class offsets, and this should eventually be removed from - // LayoutRecordType() in the external + // clang for virtual base class offsets, and this should eventually + // be removed from LayoutRecordType() in the external // AST source in clang. } else { layout_info.base_offsets.insert(std::make_pair( @@ -3547,14 +3490,13 @@ bool skip = false; if (skip_artificial) { if (is_artificial) { - // In order to determine if a C++ member function is - // "const" we have to look at the const-ness of "this"... - // Ugly, but that + // In order to determine if a C++ member function is "const" we + // have to look at the const-ness of "this"... Ugly, but that if (arg_idx == 0) { if (DeclKindIsCXXClass(containing_decl_ctx->getDeclKind())) { // Often times compilers omit the "this" name for the - // specification DIEs, so we can't rely upon the name - // being in the formal parameter DIE... + // specification DIEs, so we can't rely upon the name being in + // the formal parameter DIE... if (name == NULL || ::strcmp(name, "this") == 0) { Type *this_type = die.ResolveTypeUID(DIERef(param_type_die_form)); @@ -3618,10 +3560,10 @@ case DW_TAG_template_type_parameter: case DW_TAG_template_value_parameter: case DW_TAG_GNU_template_parameter_pack: - // The one caller of this was never using the template_param_infos, - // and the local variable was taking up a large amount of stack space - // in SymbolFileDWARF::ParseType() so this was removed. If we ever need - // the template params back, we can add them back. + // The one caller of this was never using the template_param_infos, and + // the local variable was taking up a large amount of stack space in + // SymbolFileDWARF::ParseType() so this was removed. If we ever need the + // template params back, we can add them back. // ParseTemplateDIE (dwarf_cu, die, template_param_infos); has_template_params = true; break; @@ -4157,8 +4099,8 @@ // Now do the work of linking the DeclContexts and Types. if (fast_path) { - // We can do this quickly. Just run across the tables index-for-index since - // we know each node has matching names and tags. + // We can do this quickly. Just run across the tables index-for-index + // since we know each node has matching names and tags. for (idx = 0; idx < src_size; ++idx) { src_die = src_name_to_die.GetValueAtIndexUnchecked(idx); dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx); @@ -4195,9 +4137,9 @@ } } } else { - // 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. + // 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(); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp @@ -157,7 +157,8 @@ Type *type = dwarf->ResolveTypeUID(encoding_uid); if (type) { if (go_kind == 0 && type->GetName() == type_name_const_str) { - // Go emits extra typedefs as a forward declaration. Ignore these. + // Go emits extra typedefs as a forward declaration. Ignore + // these. dwarf->m_die_to_type[die.GetDIE()] = type; return type->shared_from_this(); } @@ -212,10 +213,10 @@ // TODO(ribrdb): Do we need this? - // UniqueDWARFASTType is large, so don't create a local variables on the - // stack, put it on the heap. This function is often called recursively - // and clang isn't good and sharing the stack space for variables in - // different blocks. + // UniqueDWARFASTType is large, so don't create a local variables on + // the stack, put it on the heap. This function is often called + // recursively and clang isn't good and sharing the stack space for + // variables in different blocks. std::unique_ptr unique_ast_entry_ap( new UniqueDWARFASTType()); @@ -224,11 +225,10 @@ dwarf->GetUniqueDWARFASTTypeMap().Find( type_name_const_str, die, decl, byte_size_valid ? byte_size : -1, *unique_ast_entry_ap)) { - // We have already parsed this type or from another - // compile unit. GCC loves to use the "one definition - // rule" which can result in multiple definitions - // of the same class over and over in each compile - // unit. + // We have already parsed this type or from another compile unit. GCC + // loves to use the "one definition rule" which can result in + // multiple definitions of the same class over and over in each + // compile unit. type_sp = unique_ast_entry_ap->m_type_sp; if (type_sp) { dwarf->m_die_to_type[die.GetDIE()] = type_sp.get(); @@ -254,9 +254,9 @@ Type::eEncodingIsUID, &decl, compiler_type, Type::eResolveStateForward)); - // Add our type to the unique type map so we don't - // end up creating many copies of the same type over - // and over in the ASTContext for our module + // Add our type to the unique type map so we don't end up creating many + // copies of the same type over and over in the ASTContext for our + // module unique_ast_entry_ap->m_type_sp = type_sp; unique_ast_entry_ap->m_die = die; unique_ast_entry_ap->m_declaration = decl; @@ -265,19 +265,19 @@ *unique_ast_entry_ap); if (!is_forward_declaration) { - // Always start the definition for a class type so that - // if the class has child classes or types that require - // the class to be created for use as their decl contexts - // the class will be ready to accept these child definitions. + // Always start the definition for a class type so that if the class + // has child classes or types that require the class to be created + // for use as their decl contexts the class will be ready to accept + // these child definitions. if (die.HasChildren() == false) { // No children for this struct/union/class, lets finish it m_ast.CompleteStructType(compiler_type); } else if (compiler_type_was_created) { - // Leave this as a forward declaration until we need - // to know the details of the type. lldb_private::Type - // will automatically call the SymbolFile virtual function - // "SymbolFileDWARF::CompleteType(Type *)" - // When the definition needs to be defined. + // Leave this as a forward declaration until we need to know the + // details of the type. lldb_private::Type will automatically call + // the SymbolFile virtual function + // "SymbolFileDWARF::CompleteType(Type *)" When the definition + // needs to be defined. dwarf->m_forward_decl_die_to_clang_type[die.GetDIE()] = compiler_type.GetOpaqueQualType(); dwarf->m_forward_decl_clang_type_to_die[compiler_type @@ -670,8 +670,8 @@ } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp @@ -80,8 +80,8 @@ //---------------------------------------------------------------------- // DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential() // -// Append an abbreviation declaration with a sequential code for O(n) -// lookups. Handy when creating an DWARFAbbreviationDeclarationSet. +// Append an abbreviation declaration with a sequential code for O(n) lookups. +// Handy when creating an DWARFAbbreviationDeclarationSet. //---------------------------------------------------------------------- dw_uleb128_t DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential( const DWARFAbbreviationDeclaration &abbrevDecl) { @@ -115,9 +115,9 @@ //---------------------------------------------------------------------- // Encode // -// Encode the abbreviation table onto the end of the buffer provided -// into a byte representation as would be found in a ".debug_abbrev" -// debug information section. +// Encode the abbreviation table onto the end of the buffer provided into a +// byte representation as would be found in a ".debug_abbrev" debug information +// section. //---------------------------------------------------------------------- // void // DWARFAbbreviationDeclarationSet::Encode(BinaryStreamBuf& debug_abbrev_buf) Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp @@ -46,19 +46,17 @@ if (m_arange_descriptors.empty()) return; - // Iterate through all arange descriptors and combine any ranges that - // overlap or have matching boundaries. The m_arange_descriptors are assumed - // to be in ascending order after being built by adding descriptors - // using the AddDescriptor method. + // Iterate through all arange descriptors and combine any ranges that overlap + // or have matching boundaries. The m_arange_descriptors are assumed to be in + // ascending order after being built by adding descriptors using the + // AddDescriptor method. uint32_t i = 0; while (i + 1 < m_arange_descriptors.size()) { if (m_arange_descriptors[i].end_address() >= m_arange_descriptors[i + 1].address) { // The current range ends at or exceeds the start of the next address - // range. - // Compute the max end address between the two and use that to make the - // new - // length. + // range. Compute the max end address between the two and use that to + // make the new length. const dw_addr_t max_end_addr = std::max(m_arange_descriptors[i].end_address(), m_arange_descriptors[i + 1].end_address()); @@ -82,8 +80,8 @@ } //---------------------------------------------------------------------- -// Add a range descriptor and keep things sorted so we can easily -// compact the ranges before being saved or used. +// Add a range descriptor and keep things sorted so we can easily compact the +// ranges before being saved or used. //---------------------------------------------------------------------- void DWARFDebugArangeSet::AddDescriptor( const DWARFDebugArangeSet::Descriptor &range) { @@ -103,15 +101,14 @@ // Non-contiguous entries, add this one before the found entry m_arange_descriptors.insert(pos, range); } else if (range_end_addr == pos->address) { - // The top end of 'range' is the lower end of the entry - // pointed to by 'pos'. We can combine range with the - // entry we found by setting the starting address and - // increasing the length since they don't overlap. + // The top end of 'range' is the lower end of the entry pointed to by + // 'pos'. We can combine range with the entry we found by setting the + // starting address and increasing the length since they don't overlap. pos->address = range.address; pos->length += range.length; } else { - // We can combine these two and make sure the largest end - // address is used to make end address. + // We can combine these two and make sure the largest end address is + // used to make end address. pos->address = range.address; pos->length = std::max(found_end_addr, range_end_addr) - pos->address; } @@ -142,18 +139,18 @@ // 7.20 Address Range Table // - // Each set of entries in the table of address ranges contained in - // the .debug_aranges section begins with a header consisting of: a - // 4-byte length containing the length of the set of entries for this - // compilation unit, not including the length field itself; a 2-byte - // version identifier containing the value 2 for DWARF Version 2; a - // 4-byte offset into the.debug_infosection; a 1-byte unsigned integer - // containing the size in bytes of an address (or the offset portion of - // an address for segmented addressing) on the target system; and a - // 1-byte unsigned integer containing the size in bytes of a segment - // descriptor on the target system. This header is followed by a series - // of tuples. Each tuple consists of an address and a length, each in - // the size appropriate for an address on the target architecture. + // Each set of entries in the table of address ranges contained in the + // .debug_aranges section begins with a header consisting of: a 4-byte + // length containing the length of the set of entries for this compilation + // unit, not including the length field itself; a 2-byte version identifier + // containing the value 2 for DWARF Version 2; a 4-byte offset into + // the.debug_infosection; a 1-byte unsigned integer containing the size in + // bytes of an address (or the offset portion of an address for segmented + // addressing) on the target system; and a 1-byte unsigned integer + // containing the size in bytes of a segment descriptor on the target + // system. This header is followed by a series of tuples. Each tuple + // consists of an address and a length, each in the size appropriate for an + // address on the target architecture. m_header.length = data.GetDWARFInitialLength(offset_ptr); m_header.version = data.GetU16(offset_ptr); m_header.cu_offset = data.GetDWARFOffset(offset_ptr); @@ -195,8 +192,8 @@ arangeDescriptor.length = data.GetMaxU64(offset_ptr, m_header.addr_size); - // Each set of tuples is terminated by a 0 for the address and 0 - // for the length. + // Each set of tuples is terminated by a 0 for the address and 0 for + // the length. if (arangeDescriptor.address || arangeDescriptor.length) m_arange_descriptors.push_back(arangeDescriptor); else Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -120,8 +120,8 @@ } bool DWARFDebugInfo::ContainsCompileUnit(const DWARFUnit *cu) const { - // Not a verify efficient function, but it is handy for use in assertions - // to make sure that a compile unit comes from a debug information file. + // Not a verify efficient function, but it is handy for use in assertions to + // make sure that a compile unit comes from a debug information file. CompileUnitColl::const_iterator end_pos = m_compile_units.end(); CompileUnitColl::const_iterator pos; @@ -227,12 +227,12 @@ //---------------------------------------------------------------------- // Parse // -// Parses the .debug_info section and uses the .debug_abbrev section -// and various other sections in the SymbolFileDWARF class and calls the -// supplied callback function each time a compile unit header, or debug -// information entry is successfully parsed. This function can be used -// for different tasks such as parsing the file contents into a -// structured data, dumping, verifying and much more. +// Parses the .debug_info section and uses the .debug_abbrev section and +// various other sections in the SymbolFileDWARF class and calls the supplied +// callback function each time a compile unit header, or debug information +// entry is successfully parsed. This function can be used for different tasks +// such as parsing the file contents into a structured data, dumping, verifying +// and much more. //---------------------------------------------------------------------- void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback, void *userData) { @@ -252,8 +252,8 @@ // Make sure we are within our compile unit if (offset < next_cu_offset) { - // We are in our compile unit, parse starting at the offset - // we were told to parse + // We are in our compile unit, parse starting at the offset we were + // told to parse bool done = false; while (!done && die.Extract(dwarf2Data, cu.get(), &offset)) { // Call the callback function with DIE pointer that falls within the @@ -301,11 +301,11 @@ // DumpCallback // // A callback function for the static DWARFDebugInfo::Parse() function -// that gets called each time a compile unit header or debug information -// entry is successfully parsed. +// that gets called each time a compile unit header or debug information entry +// is successfully parsed. // -// This function dump DWARF information and obey recurse depth and -// whether a single DIE is to be dumped (or all of the data). +// This function dump DWARF information and obey recurse depth and whether a +// single DIE is to be dumped (or all of the data). //---------------------------------------------------------------------- static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, DWARFDebugInfoEntry *die, @@ -403,8 +403,8 @@ dumpInfo->ancestors.resize(1); } - // We are dumping only a single DIE possibly with it's children and - // we must find it's compile unit before we can dump it properly + // We are dumping only a single DIE possibly with it's children and we + // must find it's compile unit before we can dump it properly if (cu && dumpInfo->die_offset < cu->GetFirstDIEOffset()) { // Not found, maybe the DIE offset provided wasn't correct? // *ostrm_ptr << "DIE at offset " << HEX32 << dumpInfo->die_offset << " @@ -436,14 +436,13 @@ //---------------------------------------------------------------------- // Dump // -// Dump the information in the .debug_info section to the specified -// ostream. If die_offset is valid, a single DIE will be dumped. If the -// die_offset is invalid, all the DWARF information will be dumped. Both -// cases will obey a "recurse_depth" or how deep to traverse into the -// children of each DIE entry. A recurse_depth of zero will dump all -// compile unit headers. A recurse_depth of 1 will dump all compile unit -// headers and the DW_TAG_compile unit tags. A depth of 2 will also -// dump all types and functions. +// Dump the information in the .debug_info section to the specified ostream. If +// die_offset is valid, a single DIE will be dumped. If the die_offset is +// invalid, all the DWARF information will be dumped. Both cases will obey a +// "recurse_depth" or how deep to traverse into the children of each DIE entry. +// A recurse_depth of zero will dump all compile unit headers. A recurse_depth +// of 1 will dump all compile unit headers and the DW_TAG_compile unit tags. A +// depth of 2 will also dump all types and functions. //---------------------------------------------------------------------- void DWARFDebugInfo::Dump(Stream *s, SymbolFileDWARF *dwarf2Data, const uint32_t die_offset, @@ -469,8 +468,8 @@ //---------------------------------------------------------------------- // Dump // -// Dump the contents of this DWARFDebugInfo object as has been parsed -// and/or modified after it has been parsed. +// Dump the contents of this DWARFDebugInfo object as has been parsed and/or +// modified after it has been parsed. //---------------------------------------------------------------------- void DWARFDebugInfo::Dump(Stream *s, const uint32_t die_offset, const uint32_t recurse_depth) { Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -189,9 +189,9 @@ //---------------------------------------------------------------------- // Extract // -// Extract a debug info entry for a given compile unit from the -// .debug_info and .debug_abbrev data within the SymbolFileDWARF class -// starting at the given offset +// Extract a debug info entry for a given compile unit from the .debug_info and +// .debug_abbrev data within the SymbolFileDWARF class starting at the given +// offset //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -246,8 +246,7 @@ uint32_t form_size = 0; switch (form) { // Blocks if inlined data that have a length field and the data - // bytes - // inlined in the .debug_info + // bytes inlined in the .debug_info case DW_FORM_exprloc: case DW_FORM_block: form_size = debug_info_data.GetULEB128(&offset); @@ -357,8 +356,8 @@ //---------------------------------------------------------------------- // DumpAncestry // -// Dumps all of a debug information entries parents up until oldest and -// all of it's attributes to the specified stream. +// Dumps all of a debug information entries parents up until oldest and all of +// it's attributes to the specified stream. //---------------------------------------------------------------------- void DWARFDebugInfoEntry::DumpAncestry(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -375,8 +374,7 @@ // GetDIENamesAndRanges // // Gets the valid address ranges for a given DIE by looking for a -// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges -// attributes. +// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::GetDIENamesAndRanges( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const char *&name, @@ -452,9 +450,9 @@ const DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges(); if (debug_ranges) { debug_ranges->FindRanges(cu->GetRangesBase(), form_value.Unsigned(), ranges); - // All DW_AT_ranges are relative to the base address of the - // compile unit. We add the compile unit base address to make - // sure all the addresses are properly fixed up. + // All DW_AT_ranges are relative to the base address of the compile + // unit. We add the compile unit base address to make sure all the + // addresses are properly fixed up. ranges.Slide(cu->GetBaseAddress()); } else { cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError( @@ -583,8 +581,8 @@ //---------------------------------------------------------------------- // Dump // -// Dumps a debug information entry and all of it's attributes to the -// specified stream. +// Dumps a debug information entry and all of it's attributes to the specified +// stream. //---------------------------------------------------------------------- void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, Stream &s, @@ -659,9 +657,9 @@ //---------------------------------------------------------------------- // DumpAttribute // -// Dumps a debug information entry attribute along with it's form. Any -// special display of attributes is done (disassemble location lists, -// show enumeration values for attributes, etc). +// Dumps a debug information entry attribute along with it's form. Any special +// display of attributes is done (disassemble location lists, show enumeration +// values for attributes, etc). //---------------------------------------------------------------------- void DWARFDebugInfoEntry::DumpAttribute( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -717,9 +715,8 @@ DWARFExpression::PrintDWARFExpression( s, locationData, DWARFUnit::GetAddressByteSize(cu), 4, false); } else { - // We have a location list offset as the value that is - // the offset into the .debug_loc section that describes - // the value over it's lifetime + // We have a location list offset as the value that is the offset into + // the .debug_loc section that describes the value over it's lifetime uint64_t debug_loc_offset = form_value.Unsigned(); if (dwarf2Data) { DWARFExpression::PrintDWARFLocationList( @@ -760,9 +757,9 @@ //---------------------------------------------------------------------- // Get all attribute values for a given DIE, including following any -// specification or abstract origin attributes and including those in -// the results. Any duplicate attributes will have the first instance -// take precedence (this can happen for declaration attributes). +// specification or abstract origin attributes and including those in the +// results. Any duplicate attributes will have the first instance take +// precedence (this can happen for declaration attributes). //---------------------------------------------------------------------- size_t DWARFDebugInfoEntry::GetAttributes( const DWARFUnit *cu, DWARFFormValue::FixedFormSizes fixed_form_sizes, @@ -804,9 +801,9 @@ case DW_AT_sibling: case DW_AT_declaration: if (curr_depth > 0) { - // This attribute doesn't make sense when combined with - // the DIE that references this DIE. We know a DIE is - // referencing this DIE because curr_depth is not zero + // This attribute doesn't make sense when combined with the DIE that + // references this DIE. We know a DIE is referencing this DIE because + // curr_depth is not zero break; } LLVM_FALLTHROUGH; @@ -842,9 +839,9 @@ // GetAttributeValue // // Get the value of an attribute and return the .debug_info offset of the -// attribute if it was properly extracted into form_value, or zero -// if we fail since an offset of zero is invalid for an attribute (it -// would be a compile unit header). +// attribute if it was properly extracted into form_value, or zero if we fail +// since an offset of zero is invalid for an attribute (it would be a compile +// unit header). //---------------------------------------------------------------------- dw_offset_t DWARFDebugInfoEntry::GetAttributeValue( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -930,10 +927,10 @@ //---------------------------------------------------------------------- // GetAttributeValueAsString // -// Get the value of an attribute as a string return it. The resulting -// pointer to the string data exists within the supplied SymbolFileDWARF -// and will only be available as long as the SymbolFileDWARF is still around -// and it's content doesn't change. +// Get the value of an attribute as a string return it. The resulting pointer +// to the string data exists within the supplied SymbolFileDWARF and will only +// be available as long as the SymbolFileDWARF is still around and it's content +// doesn't change. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetAttributeValueAsString( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -981,8 +978,8 @@ //---------------------------------------------------------------------- // GetAttributeValueAsReference // -// Get the value of an attribute as reference and fix up and compile -// unit relative offsets as needed. +// Get the value of an attribute as reference and fix up and compile unit +// relative offsets as needed. //---------------------------------------------------------------------- uint64_t DWARFDebugInfoEntry::GetAttributeValueAsReference( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1009,8 +1006,8 @@ //---------------------------------------------------------------------- // GetAttributeHighPC // -// Get the hi_pc, adding hi_pc to lo_pc when specified -// as an . +// Get the hi_pc, adding hi_pc to lo_pc when specified as an . // // Returns the hi_pc or fail_value. //---------------------------------------------------------------------- @@ -1033,8 +1030,8 @@ //---------------------------------------------------------------------- // GetAttributeAddressRange // -// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified -// as an . +// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified as an . // // Returns true or sets lo_pc and hi_pc to fail_value. //---------------------------------------------------------------------- @@ -1085,8 +1082,8 @@ //---------------------------------------------------------------------- // GetName // -// Get value of the DW_AT_name attribute and return it if one exists, -// else return NULL. +// Get value of the DW_AT_name attribute and return it if one exists, else +// return NULL. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu) const { @@ -1096,8 +1093,8 @@ //---------------------------------------------------------------------- // GetMangledName // -// Get value of the DW_AT_MIPS_linkage_name attribute and return it if -// one exists, else return the value of the DW_AT_name attribute +// Get value of the DW_AT_MIPS_linkage_name attribute and return it if one +// exists, else return the value of the DW_AT_name attribute //---------------------------------------------------------------------- const char * DWARFDebugInfoEntry::GetMangledName(SymbolFileDWARF *dwarf2Data, @@ -1125,8 +1122,8 @@ //---------------------------------------------------------------------- // GetPubname // -// Get value the name for a DIE as it should appear for a -// .debug_pubnames or .debug_pubtypes section. +// Get value the name for a DIE as it should appear for a .debug_pubnames or +// .debug_pubtypes section. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetPubname(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu) const { @@ -1151,11 +1148,10 @@ //---------------------------------------------------------------------- // GetName // -// Get value of the DW_AT_name attribute for a debug information entry -// that exists at offset "die_offset" and place that value into the -// supplied stream object. If the DIE is a NULL object "NULL" is placed -// into the stream, and if no DW_AT_name attribute exists for the DIE -// then nothing is printed. +// Get value of the DW_AT_name attribute for a debug information entry that +// exists at offset "die_offset" and place that value into the supplied stream +// object. If the DIE is a NULL object "NULL" is placed into the stream, and if +// no DW_AT_name attribute exists for the DIE then nothing is printed. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1186,10 +1182,9 @@ //---------------------------------------------------------------------- // AppendTypeName // -// Follows the type name definition down through all needed tags to -// end up with a fully qualified type name and dump the results to -// the supplied stream. This is used to show the name of types given -// a type identifier. +// Follows the type name definition down through all needed tags to end up with +// a fully qualified type name and dump the results to the supplied stream. +// This is used to show the name of types given a type identifier. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1345,10 +1340,10 @@ //---------------------------------------------------------------------- // BuildFunctionAddressRangeTable // -// This function is very similar to the BuildAddressRangeTable function -// except that the actual DIE offset for the function is placed in the -// table instead of the compile unit offset (which is the way the -// standard .debug_aranges section does it). +// This function is very similar to the BuildAddressRangeTable function except +// that the actual DIE offset for the function is placed in the table instead +// of the compile unit offset (which is the way the standard .debug_aranges +// section does it). //---------------------------------------------------------------------- void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1421,9 +1416,9 @@ DWARFDIE die(cu, const_cast(this)); while (die) { - // If this is the original DIE that we are searching for a declaration - // for, then don't look in the cache as we don't want our own decl - // context to be our decl context... + // If this is the original DIE that we are searching for a declaration for, + // then don't look in the cache as we don't want our own decl context to be + // our decl context... if (die.GetDIE() != this) { switch (die.Tag()) { case DW_TAG_compile_unit: @@ -1712,9 +1707,10 @@ break; } } - } else { // compile units may not have a valid high/low pc when there + } else { + // Compile units may not have a valid high/low pc when there // are address gaps in subroutines so we must always search - // if there is no valid high and low PC + // if there is no valid high and low PC. check_children = (m_tag == DW_TAG_compile_unit || m_tag == DW_TAG_partial_unit) && ((function_die != NULL) || (block_die != NULL)); @@ -1726,9 +1722,9 @@ DWARFRangeList ranges; DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges(); debug_ranges->FindRanges(cu->GetRangesBase(), debug_ranges_offset, ranges); - // All DW_AT_ranges are relative to the base address of the - // compile unit. We add the compile unit base address to make - // sure all the addresses are properly fixed up. + // All DW_AT_ranges are relative to the base address of the compile + // unit. We add the compile unit base address to make sure all the + // addresses are properly fixed up. ranges.Slide(cu->GetBaseAddress()); if (ranges.FindEntryThatContains(address)) { found_address = true; @@ -1790,8 +1786,8 @@ const DWARFAbbreviationDeclaration *abbrev_decl = abbrev_set->GetAbbreviationDeclaration(m_abbr_idx); if (abbrev_decl) { - // Make sure the abbreviation code still matches. If it doesn't and - // the DWARF data was mmap'ed, the backing file might have been modified + // Make sure the abbreviation code still matches. If it doesn't and the + // DWARF data was mmap'ed, the backing file might have been modified // which is bad news. const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128(&offset); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -242,8 +242,8 @@ log->Printf("0x%8.8x: DW_LNE_??? (%2.2x) - Skipping unknown upcode", op_offset, opcode); // Length doesn't include the zero opcode byte or the length itself, - // but - // it does include the sub_opcode, so we have to adjust for that below + // but it does include the sub_opcode, so we have to adjust for that + // below offset += arg_size; break; } @@ -324,9 +324,9 @@ // Special Opcodes default: if (opcode < prologue.opcode_base) { - // We have an opcode that this parser doesn't know about, skip - // the number of ULEB128 numbers that is says to skip in the - // prologue's standard_opcode_lengths array + // We have an opcode that this parser doesn't know about, skip the + // number of ULEB128 numbers that is says to skip in the prologue's + // standard_opcode_lengths array uint8_t n = prologue.standard_opcode_lengths[opcode - 1]; log->Printf("0x%8.8x: Special : Unknown skipping %u ULEB128 values.", op_offset, n); @@ -357,9 +357,9 @@ //---------------------------------------------------------------------- // Parse // -// Parse the entire line table contents calling callback each time a -// new prologue is parsed and every time a new row is to be added to -// the line table. +// Parse the entire line table contents calling callback each time a new +// prologue is parsed and every time a new row is to be added to the line +// table. //---------------------------------------------------------------------- void DWARFDebugLine::Parse(const DWARFDataExtractor &debug_line_data, DWARFDebugLine::State::Callback callback, @@ -472,9 +472,9 @@ //---------------------------------------------------------------------- // ParseStatementTable // -// Parse a single line table (prologue and all rows) and call the -// callback function once for the prologue (row in state will be zero) -// and each time a row is to be added to the line table. +// Parse a single line table (prologue and all rows) and call the callback +// function once for the prologue (row in state will be zero) and each time a +// row is to be added to the line table. //---------------------------------------------------------------------- bool DWARFDebugLine::ParseStatementTable( const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, @@ -511,8 +511,8 @@ uint8_t opcode = debug_line_data.GetU8(offset_ptr); if (opcode == 0) { - // Extended Opcodes always start with a zero opcode followed by - // a uleb128 length so you can skip ones you don't know about + // Extended Opcodes always start with a zero opcode followed by a uleb128 + // length so you can skip ones you don't know about lldb::offset_t ext_offset = *offset_ptr; dw_uleb128_t len = debug_line_data.GetULEB128(offset_ptr); dw_offset_t arg_size = len - (*offset_ptr - ext_offset); @@ -522,12 +522,12 @@ switch (sub_opcode) { case DW_LNE_end_sequence: // Set the end_sequence register of the state machine to true and - // append a row to the matrix using the current values of the - // state-machine registers. Then reset the registers to the initial - // values specified above. Every statement program sequence must end - // with a DW_LNE_end_sequence instruction which creates a row whose - // address is that of the byte after the last target machine instruction - // of the sequence. + // append a row to the matrix using the current values of the state- + // machine registers. Then reset the registers to the initial values + // specified above. Every statement program sequence must end with a + // DW_LNE_end_sequence instruction which creates a row whose address is + // that of the byte after the last target machine instruction of the + // sequence. state.end_sequence = true; state.AppendRowToMatrix(*offset_ptr); state.Reset(); @@ -537,8 +537,8 @@ // Takes a single relocatable address as an operand. The size of the // operand is the size appropriate to hold an address on the target // machine. Set the address register to the value given by the - // relocatable address. All of the other statement program opcodes - // that affect the address register add a delta to it. This instruction + // relocatable address. All of the other statement program opcodes that + // affect the address register add a delta to it. This instruction // stores a relocatable value into it instead. if (arg_size == 4) state.address = debug_line_data.GetU32(offset_ptr); @@ -549,24 +549,24 @@ case DW_LNE_define_file: // Takes 4 arguments. The first is a null terminated string containing // a source file name. The second is an unsigned LEB128 number - // representing - // the directory index of the directory in which the file was found. The - // third is an unsigned LEB128 number representing the time of last - // modification of the file. The fourth is an unsigned LEB128 number - // representing the length in bytes of the file. The time and length - // fields may contain LEB128(0) if the information is not available. + // representing the directory index of the directory in which the file + // was found. The third is an unsigned LEB128 number representing the + // time of last modification of the file. The fourth is an unsigned + // LEB128 number representing the length in bytes of the file. The time + // and length fields may contain LEB128(0) if the information is not + // available. // // The directory index represents an entry in the include_directories - // section of the statement program prologue. The index is LEB128(0) - // if the file was found in the current directory of the compilation, + // section of the statement program prologue. The index is LEB128(0) if + // the file was found in the current directory of the compilation, // LEB128(1) if it was found in the first directory in the // include_directories section, and so on. The directory index is // ignored for file names that represent full path names. // // The files are numbered, starting at 1, in the order in which they - // appear; the names in the prologue come before names defined by - // the DW_LNE_define_file instruction. These numbers are used in the - // file register of the state machine. + // appear; the names in the prologue come before names defined by the + // DW_LNE_define_file instruction. These numbers are used in the file + // register of the state machine. { FileNameEntry fileEntry; fileEntry.name = debug_line_data.GetCStr(offset_ptr); @@ -578,8 +578,9 @@ break; default: - // Length doesn't include the zero opcode byte or the length itself, but - // it does include the sub_opcode, so we have to adjust for that below + // Length doesn't include the zero opcode byte or the length itself, + // but it does include the sub_opcode, so we have to adjust for that + // below (*offset_ptr) += arg_size; break; } @@ -587,23 +588,23 @@ switch (opcode) { // Standard Opcodes case DW_LNS_copy: - // Takes no arguments. Append a row to the matrix using the - // current values of the state-machine registers. Then set - // the basic_block register to false. + // Takes no arguments. Append a row to the matrix using the current + // values of the state-machine registers. Then set the basic_block + // register to false. state.AppendRowToMatrix(*offset_ptr); break; case DW_LNS_advance_pc: // Takes a single unsigned LEB128 operand, multiplies it by the - // min_inst_length field of the prologue, and adds the - // result to the address register of the state machine. + // min_inst_length field of the prologue, and adds the result to the + // address register of the state machine. state.address += debug_line_data.GetULEB128(offset_ptr) * prologue->min_inst_length; break; case DW_LNS_advance_line: - // Takes a single signed LEB128 operand and adds that value to - // the line register of the state machine. + // Takes a single signed LEB128 operand and adds that value to the line + // register of the state machine. state.line += debug_line_data.GetSLEB128(offset_ptr); break; @@ -614,35 +615,35 @@ break; case DW_LNS_set_column: - // Takes a single unsigned LEB128 operand and stores it in the - // column register of the state machine. + // Takes a single unsigned LEB128 operand and stores it in the column + // register of the state machine. state.column = debug_line_data.GetULEB128(offset_ptr); break; case DW_LNS_negate_stmt: - // Takes no arguments. Set the is_stmt register of the state - // machine to the logical negation of its current value. + // Takes no arguments. Set the is_stmt register of the state machine to + // the logical negation of its current value. state.is_stmt = !state.is_stmt; break; case DW_LNS_set_basic_block: - // Takes no arguments. Set the basic_block register of the - // state machine to true + // Takes no arguments. Set the basic_block register of the state + // machine to true state.basic_block = true; break; case DW_LNS_const_add_pc: - // Takes no arguments. Add to the address register of the state - // machine the address increment value corresponding to special - // opcode 255. The motivation for DW_LNS_const_add_pc is this: - // when the statement program needs to advance the address by a - // small amount, it can use a single special opcode, which occupies - // a single byte. When it needs to advance the address by up to - // twice the range of the last special opcode, it can use - // DW_LNS_const_add_pc followed by a special opcode, for a total - // of two bytes. Only if it needs to advance the address by more - // than twice that range will it need to use both DW_LNS_advance_pc - // and a special opcode, requiring three or more bytes. + // Takes no arguments. Add to the address register of the state machine + // the address increment value corresponding to special opcode 255. The + // motivation for DW_LNS_const_add_pc is this: when the statement + // program needs to advance the address by a small amount, it can use a + // single special opcode, which occupies a single byte. When it needs + // to advance the address by up to twice the range of the last special + // opcode, it can use DW_LNS_const_add_pc followed by a special opcode, + // for a total of two bytes. Only if it needs to advance the address by + // more than twice that range will it need to use both + // DW_LNS_advance_pc and a special opcode, requiring three or more + // bytes. { uint8_t adjust_opcode = 255 - prologue->opcode_base; dw_addr_t addr_offset = (adjust_opcode / prologue->line_range) * @@ -652,40 +653,40 @@ break; case DW_LNS_fixed_advance_pc: - // Takes a single uhalf operand. Add to the address register of - // the state machine the value of the (unencoded) operand. This - // is the only extended opcode that takes an argument that is not - // a variable length number. The motivation for DW_LNS_fixed_advance_pc - // is this: existing assemblers cannot emit DW_LNS_advance_pc or - // special opcodes because they cannot encode LEB128 numbers or - // judge when the computation of a special opcode overflows and - // requires the use of DW_LNS_advance_pc. Such assemblers, however, - // can use DW_LNS_fixed_advance_pc instead, sacrificing compression. + // Takes a single uhalf operand. Add to the address register of the + // state machine the value of the (unencoded) operand. This is the only + // extended opcode that takes an argument that is not a variable length + // number. The motivation for DW_LNS_fixed_advance_pc is this: existing + // assemblers cannot emit DW_LNS_advance_pc or special opcodes because + // they cannot encode LEB128 numbers or judge when the computation of a + // special opcode overflows and requires the use of DW_LNS_advance_pc. + // Such assemblers, however, can use DW_LNS_fixed_advance_pc instead, + // sacrificing compression. state.address += debug_line_data.GetU16(offset_ptr); break; case DW_LNS_set_prologue_end: - // Takes no arguments. Set the prologue_end register of the - // state machine to true + // Takes no arguments. Set the prologue_end register of the state + // machine to true state.prologue_end = true; break; case DW_LNS_set_epilogue_begin: - // Takes no arguments. Set the basic_block register of the - // state machine to true + // Takes no arguments. Set the basic_block register of the state + // machine to true state.epilogue_begin = true; break; case DW_LNS_set_isa: - // Takes a single unsigned LEB128 operand and stores it in the - // column register of the state machine. + // Takes a single unsigned LEB128 operand and stores it in the column + // register of the state machine. state.isa = debug_line_data.GetULEB128(offset_ptr); break; default: - // Handle any unknown standard opcodes here. We know the lengths - // of such opcodes because they are specified in the prologue - // as a multiple of LEB128 operands for each opcode. + // Handle any unknown standard opcodes here. We know the lengths of + // such opcodes because they are specified in the prologue as a + // multiple of LEB128 operands for each opcode. { uint8_t i; assert(static_cast(opcode - 1) < @@ -702,32 +703,32 @@ // A special opcode value is chosen based on the amount that needs // to be added to the line and address registers. The maximum line - // increment for a special opcode is the value of the line_base - // field in the header, plus the value of the line_range field, - // minus 1 (line base + line range - 1). If the desired line - // increment is greater than the maximum line increment, a standard - // opcode must be used instead of a special opcode. The "address - // advance" is calculated by dividing the desired address increment - // by the minimum_instruction_length field from the header. The - // special opcode is then calculated using the following formula: + // increment for a special opcode is the value of the line_base field in + // the header, plus the value of the line_range field, minus 1 (line base + // + line range - 1). If the desired line increment is greater than the + // maximum line increment, a standard opcode must be used instead of a + // special opcode. The "address advance" is calculated by dividing the + // desired address increment by the minimum_instruction_length field from + // the header. The special opcode is then calculated using the following + // formula: // // opcode = (desired line increment - line_base) + (line_range * address // advance) + opcode_base // - // If the resulting opcode is greater than 255, a standard opcode - // must be used instead. + // If the resulting opcode is greater than 255, a standard opcode must be + // used instead. // - // To decode a special opcode, subtract the opcode_base from the - // opcode itself to give the adjusted opcode. The amount to - // increment the address register is the result of the adjusted - // opcode divided by the line_range multiplied by the - // minimum_instruction_length field from the header. That is: + // To decode a special opcode, subtract the opcode_base from the opcode + // itself to give the adjusted opcode. The amount to increment the + // address register is the result of the adjusted opcode divided by the + // line_range multiplied by the minimum_instruction_length field from the + // header. That is: // // address increment = (adjusted opcode / line_range) * // minimum_instruction_length // - // The amount to increment the line register is the line_base plus - // the result of the adjusted opcode modulo the line_range. That is: + // The amount to increment the line register is the line_base plus the + // result of the adjusted opcode modulo the line_range. That is: // // line increment = line_base + (adjusted opcode % line_range) @@ -755,8 +756,8 @@ void *userData) { DWARFDebugLine::LineTable *line_table = (DWARFDebugLine::LineTable *)userData; if (state.row == DWARFDebugLine::State::StartParsingLineTable) { - // Just started parsing the line table, so lets keep a reference to - // the prologue using the supplied shared pointer + // Just started parsing the line table, so lets keep a reference to the + // prologue using the supplied shared pointer line_table->prologue = state.prologue; } else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) { // Done parsing line table, nothing to do for the cleanup @@ -769,8 +770,8 @@ //---------------------------------------------------------------------- // ParseStatementTable // -// Parse a line table at offset and populate the LineTable class with -// the prologue and all rows. +// Parse a line table at offset and populate the LineTable class with the +// prologue and all rows. //---------------------------------------------------------------------- bool DWARFDebugLine::ParseStatementTable( const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, @@ -936,11 +937,10 @@ if (address < cu_high_pc) return rows.size() - 1; } else { - // Rely on fact that we are using a std::vector and we can do - // pointer arithmetic to find the row index (which will be one less - // that what we found since it will find the first position after - // the current address) since std::vector iterators are just - // pointers to the container type. + // Rely on fact that we are using a std::vector and we can do pointer + // arithmetic to find the row index (which will be one less that what we + // found since it will find the first position after the current address) + // since std::vector iterators are just pointers to the container type. index = pos - begin_pos; if (pos->address > address) { if (index > 0) @@ -1005,9 +1005,9 @@ return a.address < b.address; } -// Insert a row at the correct address if the addresses can be out of -// order which can only happen when we are linking a line table that -// may have had it's contents rearranged. +// Insert a row at the correct address if the addresses can be out of order +// which can only happen when we are linking a line table that may have had +// it's contents rearranged. void DWARFDebugLine::Row::Insert(Row::collection &state_coll, const Row &state) { // If we don't have anything yet, or if the address of the last state in our @@ -1020,12 +1020,12 @@ state_coll.begin(), state_coll.end(), state, AddressLessThan)); // If the addresses are equal, we can safely replace the previous entry - // with the current one if the one it is replacing is an end_sequence entry. - // We currently always place an extra end sequence when ever we exit a valid - // address range for a function in case the functions get rearranged by - // optimizations or by order specifications. These extra end sequences will - // disappear by getting replaced with valid consecutive entries within a - // compile unit if there are no gaps. + // with the current one if the one it is replacing is an end_sequence + // entry. We currently always place an extra end sequence when ever we exit + // a valid address range for a function in case the functions get + // rearranged by optimizations or by order specifications. These extra end + // sequences will disappear by getting replaced with valid consecutive + // entries within a compile unit if there are no gaps. if (range.first == range.second) { state_coll.insert(range.first, state); } else { @@ -1065,10 +1065,9 @@ // DWARFDebugLine::State::AppendRowToMatrix //---------------------------------------------------------------------- void DWARFDebugLine::State::AppendRowToMatrix(dw_offset_t offset) { - // Each time we are to add an entry into the line table matrix - // call the callback function so that someone can do something with - // the current state of the state machine (like build a line table - // or dump the line table!) + // Each time we are to add an entry into the line table matrix call the + // callback function so that someone can do something with the current state + // of the state machine (like build a line table or dump the line table!) if (log) { if (row == 0) { log->PutCString("Address Line Column File ISA Flags"); @@ -1088,8 +1087,8 @@ // DWARFDebugLine::State::Finalize //---------------------------------------------------------------------- void DWARFDebugLine::State::Finalize(dw_offset_t offset) { - // Call the callback with a special row state when we are done parsing a - // line table + // Call the callback with a special row state when we are done parsing a line + // table row = DoneParsingLineTable; if (callback) callback(offset, *this, callbackUserData); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -89,8 +89,8 @@ debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) { dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size); dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size); - // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits - // of ones + // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits of + // ones if (begin == 0xFFFFFFFFull && addr_size == 4) begin = LLDB_INVALID_ADDRESS; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp @@ -67,8 +67,8 @@ // First compare the tags before we do expensive name compares for (pos = begin, rhs_pos = rhs_begin; pos != end; ++pos, ++rhs_pos) { if (pos->tag != rhs_pos->tag) { - // Check for DW_TAG_structure_type and DW_TAG_class_type as they are often - // used interchangeably in GCC + // Check for DW_TAG_structure_type and DW_TAG_class_type as they are + // often used interchangeably in GCC if (pos->tag == DW_TAG_structure_type && rhs_pos->tag == DW_TAG_class_type) continue; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -299,8 +299,8 @@ const DWARFUnit *cu) { uint8_t ref_addr_size; switch (form) { - // Blocks if inlined data that have a length field and the data bytes - // inlined in the .debug_info + // Blocks if inlined data that have a length field and the data bytes inlined + // in the .debug_info case DW_FORM_exprloc: case DW_FORM_block: { dw_uleb128_t size = debug_info_data.GetULEB128(offset_ptr); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -38,8 +38,7 @@ //---------------------------------------------------------------------- // ParseCompileUnitDIEsIfNeeded // -// Parses a compile unit and indexes its DIEs if it hasn't already been -// done. +// Parses a compile unit and indexes its DIEs if it hasn't already been done. //---------------------------------------------------------------------- size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { const size_t initial_die_array_size = m_die_array.size(); @@ -71,8 +70,8 @@ } uint32_t depth = 0; - // We are in our compile unit, parse starting at the offset - // we were told to parse + // We are in our compile unit, parse starting at the offset we were told to + // parse const DWARFDataExtractor &debug_info_data = m_dwarf->get_debug_info_data(); std::vector die_index_stack; die_index_stack.reserve(32); @@ -105,11 +104,10 @@ } else { if (null_die) { if (prev_die_had_children) { - // This will only happen if a DIE says is has children - // but all it contains is a NULL tag. Since we are removing - // the NULL DIEs from the list (saves up to 25% in C++ code), - // we need a way to let the DIE know that it actually doesn't - // have children. + // This will only happen if a DIE says is has children but all it + // contains is a NULL tag. Since we are removing the NULL DIEs from + // the list (saves up to 25% in C++ code), we need a way to let the + // DIE know that it actually doesn't have children. if (!m_die_array.empty()) m_die_array.back().SetEmptyChildren(true); } @@ -148,9 +146,9 @@ } } - // Give a little bit of info if we encounter corrupt DWARF (our offset - // should always terminate at or before the start of the next compilation - // unit header). + // Give a little bit of info if we encounter corrupt DWARF (our offset should + // always terminate at or before the start of the next compilation unit + // header). if (offset > next_cu_offset) { m_dwarf->GetObjectFile()->GetModule()->ReportWarning( "DWARF compile unit extends beyond its bounds cu 0x%8.8x at " @@ -158,10 +156,9 @@ GetOffset(), offset); } - // Since std::vector objects will double their size, we really need to - // make a new array with the perfect size so we don't end up wasting - // space. So here we copy and swap to make sure we don't have any extra - // memory taken up. + // Since std::vector objects will double their size, we really need to make a + // new array with the perfect size so we don't end up wasting space. So here + // we copy and swap to make sure we don't have any extra memory taken up. if (m_die_array.size() < m_die_array.capacity()) { DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(), @@ -196,8 +193,8 @@ // Only reserve the memory if we are adding children of the main compile unit // DIE. The compile unit DIE is always the first entry, so if our size is 1, - // then we are adding the first compile unit child DIE and should reserve - // the memory. + // then we are adding the first compile unit child DIE and should reserve the + // memory. m_die_array.reserve(GetDebugInfoSize() / 24); m_die_array.push_back(die); @@ -307,13 +304,12 @@ void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) { if (m_die_array.size() > 1) { - // std::vectors never get any smaller when resized to a smaller size, - // or when clear() or erase() are called, the size will report that it - // is smaller, but the memory allocated remains intact (call capacity() - // to see this). So we need to create a temporary vector and swap the - // contents which will cause just the internal pointers to be swapped - // so that when "tmp_array" goes out of scope, it will destroy the - // contents. + // std::vectors never get any smaller when resized to a smaller size, or + // when clear() or erase() are called, the size will report that it is + // smaller, but the memory allocated remains intact (call capacity() to see + // this). So we need to create a temporary vector and swap the contents + // which will cause just the internal pointers to be swapped so that when + // "tmp_array" goes out of scope, it will destroy the contents. // Save at least the compile unit DIE DWARFDebugInfoEntry::collection tmp_array; @@ -328,9 +324,9 @@ void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf, DWARFDebugAranges *debug_aranges) { - // This function is usually called if there in no .debug_aranges section - // in order to produce a compile unit level set of address ranges that - // is accurate. + // This function is usually called if there in no .debug_aranges section in + // order to produce a compile unit level set of address ranges that is + // accurate. size_t num_debug_aranges = debug_aranges->GetNumRanges(); @@ -343,10 +339,10 @@ const size_t num_ranges = die->GetAttributeAddressRanges(dwarf, this, ranges, false); if (num_ranges > 0) { - // This compile unit has DW_AT_ranges, assume this is correct if it - // is present since clang no longer makes .debug_aranges by default - // and it emits DW_AT_ranges for DW_TAG_compile_units. GCC also does - // this with recent GCC builds. + // This compile unit has DW_AT_ranges, assume this is correct if it is + // present since clang no longer makes .debug_aranges by default and it + // emits DW_AT_ranges for DW_TAG_compile_units. GCC also does this with + // recent GCC builds. for (size_t i = 0; i < num_ranges; ++i) { const DWARFRangeList::Entry &range = ranges.GetEntryRef(i); debug_aranges->AppendRange(cu_offset, range.GetRangeBase(), @@ -359,9 +355,8 @@ // We don't have a DW_AT_ranges attribute, so we need to parse the DWARF // If the DIEs weren't parsed, then we don't want all dies for all compile - // units - // to stay loaded when they weren't needed. So we can end up parsing the DWARF - // and then throwing them all away to keep memory usage down. + // units to stay loaded when they weren't needed. So we can end up parsing + // the DWARF and then throwing them all away to keep memory usage down. const bool clear_dies = ExtractDIEsIfNeeded(false) > 1; die = DIEPtr(); @@ -419,8 +414,8 @@ } } - // Keep memory down by clearing DIEs if this generate function - // caused them to be parsed + // Keep memory down by clearing DIEs if this generate function caused them to + // be parsed if (clear_dies) ClearDIEs(true); } @@ -456,10 +451,9 @@ //---------------------------------------------------------------------- // GetDIE() // -// Get the DIE (Debug Information Entry) with the specified offset by -// first checking if the DIE is contained within this compile unit and -// grabbing the DIE from this compile unit. Otherwise we grab the DIE -// from the DWARF file. +// Get the DIE (Debug Information Entry) with the specified offset by first +// checking if the DIE is contained within this compile unit and grabbing the +// DIE from this compile unit. Otherwise we grab the DIE from the DWARF file. //---------------------------------------------------------------------- DWARFDIE DWARFUnit::GetDIE(dw_offset_t die_offset) { @@ -515,8 +509,8 @@ } bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() { - // llvm-gcc makes completely invalid decl file attributes and won't ever - // be fixed, so we need to know to ignore these. + // llvm-gcc makes completely invalid decl file attributes and won't ever be + // fixed, so we need to know to ignore these. return GetProducer() == eProducerLLVMGCC; } @@ -602,8 +596,8 @@ return m_producer_version_update; } LanguageType DWARFUnit::LanguageTypeFromDWARF(uint64_t val) { - // Note: user languages between lo_user and hi_user - // must be handled explicitly here. + // Note: user languages between lo_user and hi_user must be handled + // explicitly here. switch (val) { case DW_LANG_Mips_Assembler: return eLanguageTypeMipsAssembler; @@ -851,8 +845,8 @@ func_fullnames.Insert(objc_fullname_no_category_name, DIERef(cu_offset, die.GetOffset())); } - // If we have a mangled name, then the DW_AT_name attribute - // is usually the method name without the class or any parameters + // If we have a mangled name, then the DW_AT_name attribute is + // usually the method name without the class or any parameters const DWARFDebugInfoEntry *parent = die.GetParent(); bool is_method = false; if (parent) { @@ -883,10 +877,10 @@ DIERef(cu_offset, die.GetOffset())); } if (mangled_cstr) { - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Make sure our mangled name isn't the same string table entry as + // our name. If it starts with '_', then it is ok, else compare the + // string to make sure it isn't the same and we don't end up with + // duplicate entries if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { @@ -908,10 +902,10 @@ func_basenames.Insert(ConstString(name), DIERef(cu_offset, die.GetOffset())); if (mangled_cstr) { - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Make sure our mangled name isn't the same string table entry as + // our name. If it starts with '_', then it is ok, else compare the + // string to make sure it isn't the same and we don't end up with + // duplicate entries if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { @@ -956,15 +950,15 @@ case DW_TAG_variable: if (name && has_location_or_const_value && is_global_or_static_variable) { globals.Insert(ConstString(name), DIERef(cu_offset, die.GetOffset())); - // Be sure to include variables by their mangled and demangled - // names if they have any since a variable can have a basename - // "i", a mangled named "_ZN12_GLOBAL__N_11iE" and a demangled - // mangled name "(anonymous namespace)::i"... - - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Be sure to include variables by their mangled and demangled names if + // they have any since a variable can have a basename "i", a mangled + // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name + // "(anonymous namespace)::i"... + + // Make sure our mangled name isn't the same string table entry as our + // name. If it starts with '_', then it is ok, else compare the string + // to make sure it isn't the same and we don't end up with duplicate + // entries if (mangled_cstr && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { Mangled mangled(ConstString(mangled_cstr), true); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -75,15 +75,14 @@ die_tag == DW_TAG_structure_type) { if (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) { if (return_implementation_only_if_available) { - // We found the one true definition for this class, so - // only return that + // We found the one true definition for this class, so only return + // that die_offsets.clear(); die_offsets.emplace_back(die_info_array[i].cu_offset, die_info_array[i].offset); return; } else { - // Put the one true definition as the first entry so it - // matches first + // Put the one true definition as the first entry so it matches first die_offsets.emplace(die_offsets.begin(), die_info_array[i].cu_offset, die_info_array[i].offset); } @@ -137,9 +136,8 @@ DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset) : die_base_offset(_die_base_offset), atoms(), atom_mask(0), min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) { - // Define an array of DIE offsets by first defining an array, - // and then define the atom type for the array, in this case - // we have an array of DIE offsets + // Define an array of DIE offsets by first defining an array, and then define + // the atom type for the array, in this case we have an array of DIE offsets AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); } @@ -239,8 +237,7 @@ size_t DWARFMappedHash::Prologue::GetByteSize() const { // Add an extra count to the atoms size for the zero termination Atom that - // gets - // written to disk + // gets written to disk return sizeof(die_base_offset) + sizeof(uint32_t) + atoms.size() * sizeof(Atom); } @@ -384,13 +381,13 @@ pair.key = m_data.GetU32(hash_data_offset_ptr); pair.value.clear(); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) { *hash_data_offset_ptr = UINT32_MAX; @@ -403,22 +400,21 @@ if (count > 0 && m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr, min_total_hash_data_size)) { - // We have at least one HashData entry, and we have enough - // data to parse at least "count" HashData entries. + // We have at least one HashData entry, and we have enough data to parse at + // least "count" HashData entries. // First make sure the entire C string matches... const bool match = name == strp_cstr; if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the string doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the string doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -432,16 +428,15 @@ } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -453,13 +448,13 @@ const lldb_private::RegularExpression ®ex, lldb::offset_t *hash_data_offset_ptr, Pair &pair) const { pair.key = m_data.GetU32(hash_data_offset_ptr); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) return eResultError; @@ -473,15 +468,14 @@ const bool match = regex.Execute(llvm::StringRef(strp_cstr)); if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the regex doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the regex doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -495,16 +489,15 @@ } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -529,8 +522,7 @@ switch (hash_result) { case eResultKeyMatch: case eResultKeyMismatch: - // Whether we matches or not, it doesn't matter, we - // keep looking. + // Whether we matches or not, it doesn't matter, we keep looking. break; case eResultEndOfHashData: @@ -553,8 +545,8 @@ lldb::offset_t hash_data_offset = GetHashDataOffset(offset_idx); while (!done && hash_data_offset != UINT32_MAX) { KeyType key = m_data.GetU32(&hash_data_offset); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for + // this hash value. if (key == 0) break; @@ -610,17 +602,16 @@ if (FindByName(name, die_info_array)) { if (must_be_implementation && GetHeader().header_data.ContainsAtom(eAtomTypeTypeFlags)) { - // If we have two atoms, then we have the DIE offset and - // the type flags so we can find the objective C class - // efficiently. + // If we have two atoms, then we have the DIE offset and the type flags + // so we can find the objective C class efficiently. DWARFMappedHash::ExtractTypesFromDIEArray(die_info_array, UINT32_MAX, eTypeFlagClassIsImplementation, die_offsets); } else { - // We don't only want the one true definition, so try and see - // what we can find, and only return class or struct DIEs. - // If we do have the full implementation, then return it alone, - // else return all possible matches. + // We don't only want the one true definition, so try and see what we can + // find, and only return class or struct DIEs. If we do have the full + // implementation, then return it alone, else return all possible + // matches. const bool return_implementation_only_if_available = true; DWARFMappedHash::ExtractClassOrStructDIEArray( die_info_array, return_implementation_only_if_available, die_offsets); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -164,8 +164,8 @@ return path_from_dwarf; } - // check whether we have a windows path, and so the first character - // is a drive-letter not a hostname. + // check whether we have a windows path, and so the first character is a + // drive-letter not a hostname. if (colon_pos == path_from_dwarf + 1 && isalpha(*path_from_dwarf) && strlen(path_from_dwarf) > 2 && '\\' == path_from_dwarf[2]) { return path_from_dwarf; @@ -503,15 +503,14 @@ if (section_list == NULL) return 0; - // On non Apple platforms we might have .debug_types debug info that - // is created by using "-fdebug-types-section". LLDB currently will try - // to load this debug info, but it causes crashes during debugging when - // types are missing since it doesn't know how to parse the info in - // the .debug_types type units. This causes all complex debug info - // types to be unresolved. Because this causes LLDB to crash and since - // it really doesn't provide a solid debuggiung experience, we should - // disable trying to debug this kind of DWARF until support gets - // added or deprecated. + // On non Apple platforms we might have .debug_types debug info that is + // created by using "-fdebug-types-section". LLDB currently will try to + // load this debug info, but it causes crashes during debugging when types + // are missing since it doesn't know how to parse the info in the + // .debug_types type units. This causes all complex debug info types to be + // unresolved. Because this causes LLDB to crash and since it really + // doesn't provide a solid debuggiung experience, we should disable trying + // to debug this kind of DWARF until support gets added or deprecated. if (section_list->FindSectionByName(ConstString(".debug_types"))) { m_obj_file->GetModule()->ReportWarning( "lldb doesn’t support .debug_types debug info"); @@ -563,10 +562,10 @@ if (symfile_dir_cstr) { if (strcasestr(symfile_dir_cstr, ".dsym")) { if (m_obj_file->GetType() == ObjectFile::eTypeDebugInfo) { - // We have a dSYM file that didn't have a any debug info. - // If the string table has a size of 1, then it was made from - // an executable with no debug info, or from an executable that - // was stripped. + // We have a dSYM file that didn't have a any debug info. If the + // string table has a size of 1, then it was made from an + // executable with no debug info, or from an executable that was + // stripped. section = section_list->FindSectionByType(eSectionTypeDWARFDebugStr, true) .get(); @@ -730,8 +729,8 @@ DWARFDebugInfo *info = DebugInfo(); if (info) { - // Just a normal DWARF file whose user ID for the compile unit is - // the DWARF offset itself + // Just a normal DWARF file whose user ID for the compile unit is the DWARF + // offset itself DWARFUnit *dwarf_cu = info->GetCompileUnit((dw_offset_t)comp_unit->GetID()); @@ -784,8 +783,8 @@ FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { // If we have a full path to the compile unit, we don't need to - // resolve - // the file. This can be expensive e.g. when the source files are + // resolve the file. This can be expensive e.g. when the source + // files are // NFS mounted. if (cu_file_spec.IsRelative()) { const char *cu_comp_dir{ @@ -808,10 +807,8 @@ cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo)); if (cu_sp) { // If we just created a compile unit with an invalid file spec, - // try and get the - // first entry in the supports files from the line table as that - // should be the - // compile unit. + // try and get the first entry in the supports files from the + // line table as that should be the compile unit. if (!cu_file_spec) { cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1); if (cu_file_spec) { @@ -1005,8 +1002,7 @@ (ParseDWARFLineTableCallbackInfo *)userData; LineTable *line_table = info->line_table; - // If this is our first time here, we need to create a - // sequence container. + // If this is our first time here, we need to create a sequence container. if (!info->sequence_ap.get()) { info->sequence_ap.reset(line_table->CreateLineSequenceContainer()); assert(info->sequence_ap.get()); @@ -1070,10 +1066,10 @@ &info); SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile(); if (debug_map_symfile) { - // We have an object file that has a line table with addresses - // that are not linked. We need to link the line table and convert - // the addresses that are relative to the .o file into addresses - // for the main executable. + // We have an object file that has a line table with addresses that + // are not linked. We need to link the line table and convert the + // addresses that are relative to the .o file into addresses for + // the main executable. sc.comp_unit->SetLineTable( debug_map_symfile->LinkOSOLineTable(this, line_table_ap.get())); } else { @@ -1149,9 +1145,9 @@ case DW_TAG_lexical_block: { Block *block = NULL; if (tag == DW_TAG_subprogram) { - // Skip any DW_TAG_subprogram DIEs that are inside - // of a normal or inlined functions. These will be - // parsed on their own as separate entities. + // Skip any DW_TAG_subprogram DIEs that are inside of a normal or + // inlined functions. These will be parsed on their own as separate + // entities. if (depth > 0) break; @@ -1179,18 +1175,14 @@ assert(subprogram_low_pc == LLDB_INVALID_ADDRESS); subprogram_low_pc = ranges.GetMinRangeBase(0); } else if (tag == DW_TAG_inlined_subroutine) { - // We get called here for inlined subroutines in two ways. - // The first time is when we are making the Function object - // for this inlined concrete instance. Since we're creating a top - // level block at + // We get called here for inlined subroutines in two ways. The first + // time is when we are making the Function object for this inlined + // concrete instance. Since we're creating a top level block at // here, the subprogram_low_pc will be LLDB_INVALID_ADDRESS. So we - // need to - // adjust the containing address. - // The second time is when we are parsing the blocks inside the - // function that contains - // the inlined concrete instance. Since these will be blocks inside - // the containing "real" - // function the offset will be for that function. + // need to adjust the containing address. The second time is when we + // are parsing the blocks inside the function that contains the + // inlined concrete instance. Since these will be blocks inside the + // containing "real" function the offset will be for that function. if (subprogram_low_pc == LLDB_INVALID_ADDRESS) { subprogram_low_pc = ranges.GetMinRangeBase(0); } @@ -1245,9 +1237,9 @@ break; } - // Only parse siblings of the block if we are not at depth zero. A depth - // of zero indicates we are currently parsing the top level - // DW_TAG_subprogram DIE + // Only parse siblings of the block if we are not at depth zero. A depth of + // zero indicates we are currently parsing the top level DW_TAG_subprogram + // DIE if (depth == 0) die.Clear(); @@ -1293,12 +1285,12 @@ } SymbolFileDWARF *SymbolFileDWARF::GetDWARFForUID(lldb::user_id_t uid) { - // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API - // we must make sure we use the correct DWARF file when resolving things. - // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple - // SymbolFileDWARF classes, one for each .o file. We can often end up - // with references to other DWARF objects and we must be ready to receive - // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we + // must make sure we use the correct DWARF file when resolving things. On + // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up with + // references to other DWARF objects and we must be ready to receive a + // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF // instance. SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile(); if (debug_map) @@ -1309,12 +1301,12 @@ DWARFDIE SymbolFileDWARF::GetDIEFromUID(lldb::user_id_t uid) { - // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API - // we must make sure we use the correct DWARF file when resolving things. - // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple - // SymbolFileDWARF classes, one for each .o file. We can often end up - // with references to other DWARF objects and we must be ready to receive - // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we + // must make sure we use the correct DWARF file when resolving things. On + // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up with + // references to other DWARF objects and we must be ready to receive a + // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF // instance. SymbolFileDWARF *dwarf = GetDWARFForUID(uid); if (dwarf) @@ -1323,9 +1315,9 @@ } CompilerDecl SymbolFileDWARF::GetDeclForUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDecl(); @@ -1334,9 +1326,9 @@ CompilerDeclContext SymbolFileDWARF::GetDeclContextForUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDeclContext(); @@ -1345,9 +1337,9 @@ CompilerDeclContext SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetContainingDeclContext(); @@ -1355,9 +1347,9 @@ } Type *SymbolFileDWARF::ResolveTypeUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE type_die = GetDIEFromUID(type_uid); if (type_die) return type_die.ResolveType(); @@ -1378,9 +1370,9 @@ log, "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'", die.GetOffset(), die.GetTagAsCString(), die.GetName()); - // We might be coming in in the middle of a type tree (a class - // within a class, an enum within a class), so parse any needed - // parent DIEs before we get to this one... + // We might be coming in in the middle of a type tree (a class within a + // class, an enum within a class), so parse any needed parent DIEs before + // we get to this one... DWARFDIE decl_ctx_die = GetDeclContextDIEContainingDIE(die); if (decl_ctx_die) { if (log) { @@ -1408,8 +1400,8 @@ } // This function is used when SymbolFileDWARFDebugMap owns a bunch of -// SymbolFileDWARF objects to detect if this DWARF file is the one that -// can resolve a compiler_type. +// SymbolFileDWARF objects to detect if this DWARF file is the one that can +// resolve a compiler_type. bool SymbolFileDWARF::HasForwardDeclForClangType( const CompilerType &compiler_type) { CompilerType compiler_type_no_qualifiers = @@ -1455,12 +1447,10 @@ DWARFDIE dwarf_die = GetDIE(die_it->getSecond()); if (dwarf_die) { - // Once we start resolving this type, remove it from the forward declaration - // map in case anyone child members or other types require this type to get - // resolved. - // The type will get resolved when all of the calls to - // SymbolFileDWARF::ResolveClangOpaqueTypeDefinition - // are done. + // Once we start resolving this type, remove it from the forward + // declaration map in case anyone child members or other types require this + // type to get resolved. The type will get resolved when all of the calls + // to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition are done. GetForwardDeclClangTypeToDie().erase(die_it); Type *type = GetDIEToType().lookup(dwarf_die.GetDIE()); @@ -1505,8 +1495,8 @@ uint32_t cu_idx) { // Check if the symbol vendor already knows about this compile unit? if (dwarf_cu->GetUserData() == NULL) { - // The symbol vendor doesn't know about this compile unit, we - // need to parse and add it to the symbol vendor object. + // The symbol vendor doesn't know about this compile unit, we need to parse + // and add it to the symbol vendor object. return ParseCompileUnit(dwarf_cu, cu_idx).get(); } return (CompileUnit *)dwarf_cu->GetUserData(); @@ -1652,20 +1642,18 @@ dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); - // When LLDB loads "external" modules it looks at the - // presence of DW_AT_GNU_dwo_name. - // However, when the already created module - // (corresponding to .dwo itself) is being processed, - // it will see the presence of DW_AT_GNU_dwo_name - // (which contains the name of dwo file) and - // will try to call ModuleList::GetSharedModule again. - // In some cases (i.e. for empty files) Clang 4.0 - // generates a *.dwo file which has DW_AT_GNU_dwo_name, - // but no DW_AT_comp_dir. In this case the method - // ModuleList::GetSharedModule will fail and - // the warning will be printed. However, as one can notice - // in this case we don't actually need to try to load the already - // loaded module (corresponding to .dwo) so we simply skip it. + // When LLDB loads "external" modules it looks at the presence of + // DW_AT_GNU_dwo_name. However, when the already created module + // (corresponding to .dwo itself) is being processed, it will see + // the presence of DW_AT_GNU_dwo_name (which contains the name of + // dwo file) and will try to call ModuleList::GetSharedModule + // again. In some cases (i.e. for empty files) Clang 4.0 generates + // a *.dwo file which has DW_AT_GNU_dwo_name, but no + // DW_AT_comp_dir. In this case the method + // ModuleList::GetSharedModule will fail and the warning will be + // printed. However, as one can notice in this case we don't + // actually need to try to load the already loaded module + // (corresponding to .dwo) so we simply skip it. if (m_obj_file->GetFileSpec() .GetFileNameExtension() .GetStringRef() == "dwo" && @@ -1759,13 +1747,11 @@ const dw_offset_t cu_offset = debug_info->GetCompileUnitAranges().FindAddress(file_vm_addr); if (cu_offset == DW_INVALID_OFFSET) { - // Global variables are not in the compile unit address ranges. The only - // way to - // currently find global variables is to iterate over the - // .debug_pubnames or the - // __apple_names table and find all items in there that point to - // DW_TAG_variable - // DIEs and then find the address that matches. + // Global variables are not in the compile unit address ranges. The + // only way to currently find global variables is to iterate over the + // .debug_pubnames or the __apple_names table and find all items in + // there that point to DW_TAG_variable DIEs and then find the address + // that matches. if (resolve_scope & eSymbolContextVariable) { GlobalVariableMap &map = GetGlobalAranges(); const GlobalVariableMap::Entry *entry = @@ -1833,13 +1819,10 @@ LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table != NULL) { // And address that makes it into this function should be in - // terms - // of this debug file if there is no debug map, or it will be an - // address in the .o file which needs to be fixed up to be in - // terms - // of the debug map executable. Either way, calling - // FixupAddress() - // will work for us. + // terms of this debug file if there is no debug map, or it + // will be an address in the .o file which needs to be fixed up + // to be in terms of the debug map executable. Either way, + // calling FixupAddress() will work for us. Address exe_so_addr(so_addr); if (FixupAddress(exe_so_addr)) { if (line_table->FindLineEntryByAddress(exe_so_addr, @@ -1853,11 +1836,11 @@ if (force_check_line_table && !(resolved & eSymbolContextLineEntry)) { // We might have had a compile unit that had discontiguous - // address ranges where the gaps are symbols that don't have - // any debug info. Discontiguous compile unit address ranges - // should only happen when there aren't other functions from - // other compile units in these gaps. This helps keep the size - // of the aranges down. + // address ranges where the gaps are symbols that don't have any + // debug info. Discontiguous compile unit address ranges should + // only happen when there aren't other functions from other + // compile units in these gaps. This helps keep the size of the + // aranges down. sc.comp_unit = NULL; resolved &= ~eSymbolContextCompUnit; } @@ -1899,8 +1882,8 @@ if (sc.comp_unit) { uint32_t file_idx = UINT32_MAX; - // If we are looking for inline functions only and we don't - // find it in the support files, we are done. + // If we are looking for inline functions only and we don't find it + // in the support files, we are done. if (check_inlines) { file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex( 1, file_spec, true); @@ -1912,8 +1895,8 @@ LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table != NULL && line != 0) { - // We will have already looked up the file index if - // we are searching for inline entries. + // We will have already looked up the file index if we are + // searching for inline entries. if (!check_inlines) file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex( 1, file_spec, true); @@ -1970,16 +1953,14 @@ } } else if (file_spec_matches_cu_file_spec && !check_inlines) { // only append the context if we aren't looking for inline call - // sites - // by file and line and if the file spec matches that of the - // compile unit + // sites by file and line and if the file spec matches that of + // the compile unit sc_list.Append(sc); } } else if (file_spec_matches_cu_file_spec && !check_inlines) { // only append the context if we aren't looking for inline call - // sites - // by file and line and if the file spec matches that of the - // compile unit + // sites by file and line and if the file spec matches that of + // the compile unit sc_list.Append(sc); } @@ -2044,8 +2025,8 @@ auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { - // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the - // DIEs for a compile unit have already been parsed. + // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the DIEs + // for a compile unit have already been parsed. if (dwarf_cu->ExtractDIEsIfNeeded(false) > 1) clear_cu_dies[cu_idx] = true; } @@ -2056,17 +2037,15 @@ //---------------------------------------------------------------------- // First figure out which compile units didn't have their DIEs already // parsed and remember this. If no DIEs were parsed prior to this index - // function call, we are going to want to clear the CU dies after we - // are done indexing to make sure we don't pull in all DWARF dies, but - // we need to wait until all compile units have been indexed in case - // a DIE in one compile unit refers to another and the indexes accesses - // those DIEs. + // function call, we are going to want to clear the CU dies after we are + // done indexing to make sure we don't pull in all DWARF dies, but we need + // to wait until all compile units have been indexed in case a DIE in one + // compile unit refers to another and the indexes accesses those DIEs. //---------------------------------------------------------------------- TaskMapOverInt(0, num_compile_units, extract_fn); // Now create a task runner that can index each DWARF compile unit in a - // separate - // thread so we can index quickly. + // separate thread so we can index quickly. TaskMapOverInt(0, num_compile_units, parser_fn); @@ -2130,9 +2109,9 @@ bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile( const lldb_private::CompilerDeclContext *decl_ctx) { if (decl_ctx == nullptr || !decl_ctx->IsValid()) { - // Invalid namespace decl which means we aren't matching only things - // in this symbol file, so return true to indicate it matches this - // symbol file. + // Invalid namespace decl which means we aren't matching only things in + // this symbol file, so return true to indicate it matches this symbol + // file. return true; } @@ -2175,8 +2154,8 @@ if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); DIEArray die_offsets; @@ -2285,8 +2264,8 @@ if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); DIEArray die_offsets; @@ -2443,9 +2422,8 @@ bool SymbolFileDWARF::DIEInDeclContext(const CompilerDeclContext *decl_ctx, const DWARFDIE &die) { // If we have no parent decl context to match this DIE matches, and if the - // parent - // decl context isn't valid, we aren't trying to look for any particular decl - // context so any die matches. + // parent decl context isn't valid, we aren't trying to look for any + // particular decl context so any die matches. if (decl_ctx == nullptr || !decl_ctx->IsValid()) return true; @@ -2494,8 +2472,8 @@ if (name.IsEmpty()) return 0; - // Remember how many sc_list are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many sc_list are in the list before we search in case we are + // appending the results to a variable list. const uint32_t original_size = sc_list.GetSize(); @@ -2513,10 +2491,8 @@ if (name_type_mask & eFunctionNameTypeFull) { // If they asked for the full name, match what they typed. At some - // point we may - // want to canonicalize this (strip double spaces, etc. For now, we - // just add all the - // dies that we find by exact match. + // point we may want to canonicalize this (strip double spaces, etc. + // For now, we just add all the dies that we find by exact match. num_matches = m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets); for (uint32_t i = 0; i < num_matches; i++) { @@ -2546,8 +2522,8 @@ num_matches = m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets); // Now make sure these are actually ObjC methods. In this case we can - // simply look up the name, - // and if it is an ObjC method name, we're good. + // simply look up the name, and if it is an ObjC method name, we're + // good. for (uint32_t i = 0; i < num_matches; i++) { const DIERef &die_ref = die_offsets[i]; @@ -2573,10 +2549,9 @@ if (((name_type_mask & eFunctionNameTypeMethod) && !parent_decl_ctx) || name_type_mask & eFunctionNameTypeBase) { // The apple_names table stores just the "base name" of C++ methods in - // the table. So we have to - // extract the base name, look that up, and if there is any other - // information in the name we were - // passed in we have to post-filter based on that. + // the table. So we have to extract the base name, look that up, and + // if there is any other information in the name we were passed in we + // have to post-filter based on that. // FIXME: Arrange the logic above so that we don't calculate the base // name twice: @@ -2597,8 +2572,8 @@ if ((name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeMethod)) != (eFunctionNameTypeBase | eFunctionNameTypeMethod)) { - // We are looking for either basenames or methods, so we need to - // trim out the ones we won't want by looking at the type + // We are looking for either basenames or methods, so we need + // to trim out the ones we won't want by looking at the type SymbolContext sc; if (sc_list.GetLastContext(sc)) { if (sc.block) { @@ -2651,14 +2626,13 @@ FindFunctions(name, m_function_fullname_index, include_inlines, sc_list); // FIXME Temporary workaround for global/anonymous namespace - // functions debugging FreeBSD and Linux binaries. - // If we didn't find any functions in the global namespace try - // looking in the basename index but ignore any returned - // functions that have a namespace but keep functions which - // have an anonymous namespace + // functions debugging FreeBSD and Linux binaries. If we didn't find any + // functions in the global namespace try looking in the basename index + // but ignore any returned functions that have a namespace but keep + // functions which have an anonymous namespace // TODO: The arch in the object file isn't correct for MSVC - // binaries on windows, we should find a way to make it - // correct and handle those symbols as well. + // binaries on windows, we should find a way to make it correct and + // handle those symbols as well. if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && @@ -2764,8 +2738,8 @@ if (!append) sc_list.Clear(); - // Remember how many sc_list are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many sc_list are in the list before we search in case we are + // appending the results to a variable list. uint32_t original_size = sc_list.GetSize(); if (m_using_apple_tables) { @@ -3016,8 +2990,8 @@ if (info) { DIEArray die_offsets; - // Index if we already haven't to make sure the compile units - // get indexed and make their global DIE index list + // Index if we already haven't to make sure the compile units get indexed + // and make their global DIE index list if (m_using_apple_tables) { if (m_apple_namespaces_ap.get()) { m_apple_namespaces_ap->FindByName(name.GetStringRef(), die_offsets); @@ -3166,12 +3140,10 @@ } // Some compilers don't emit the DW_AT_APPLE_objc_complete_type attribute. If -// they don't -// then we can end up looking through all class types for a complete type and -// never find -// the full definition. We need to know if this attribute is supported, so we -// determine -// this here and cache th result. We also need to worry about the debug map +// they don't then we can end up looking through all class types for a complete +// type and never find the full definition. We need to know if this attribute +// is supported, so we determine this here and cache th result. We also need to +// worry about the debug map // DWARF file // if we are doing darwin DWARF in .o file debugging. bool SymbolFileDWARF::Supports_DW_AT_APPLE_objc_complete_type( @@ -3234,7 +3206,8 @@ if (type_die) { bool try_resolving_type = false; - // Don't try and resolve the DIE we are looking for with the DIE itself! + // Don't try and resolve the DIE we are looking for with the DIE + // itself! if (type_die != die) { switch (type_die.Tag()) { case DW_TAG_class_type: @@ -3283,16 +3256,15 @@ } //---------------------------------------------------------------------- -// This function helps to ensure that the declaration contexts match for -// two different DIEs. Often times debug information will refer to a -// forward declaration of a type (the equivalent of "struct my_struct;". -// There will often be a declaration of that type elsewhere that has the -// full definition. When we go looking for the full type "my_struct", we -// will find one or more matches in the accelerator tables and we will -// then need to make sure the type was in the same declaration context -// as the original DIE. This function can efficiently compare two DIEs -// and will return true when the declaration context matches, and false -// when they don't. +// This function helps to ensure that the declaration contexts match for two +// different DIEs. Often times debug information will refer to a forward +// declaration of a type (the equivalent of "struct my_struct;". There will +// often be a declaration of that type elsewhere that has the full definition. +// When we go looking for the full type "my_struct", we will find one or more +// matches in the accelerator tables and we will then need to make sure the +// type was in the same declaration context as the original DIE. This function +// can efficiently compare two DIEs and will return true when the declaration +// context matches, and false when they don't. //---------------------------------------------------------------------- bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, const DWARFDIE &die2) { @@ -3301,32 +3273,31 @@ DWARFDIECollection decl_ctx_1; DWARFDIECollection decl_ctx_2; - // The declaration DIE stack is a stack of the declaration context - // DIEs all the way back to the compile unit. If a type "T" is - // declared inside a class "B", and class "B" is declared inside - // a class "A" and class "A" is in a namespace "lldb", and the - // namespace is in a compile unit, there will be a stack of DIEs: + // The declaration DIE stack is a stack of the declaration context DIEs all + // the way back to the compile unit. If a type "T" is declared inside a class + // "B", and class "B" is declared inside a class "A" and class "A" is in a + // namespace "lldb", and the namespace is in a compile unit, there will be a + // stack of DIEs: // // [0] DW_TAG_class_type for "B" // [1] DW_TAG_class_type for "A" // [2] DW_TAG_namespace for "lldb" // [3] DW_TAG_compile_unit or DW_TAG_partial_unit for the source file. // - // We grab both contexts and make sure that everything matches - // all the way back to the compiler unit. + // We grab both contexts and make sure that everything matches all the way + // back to the compiler unit. // First lets grab the decl contexts for both DIEs die1.GetDeclContextDIEs(decl_ctx_1); die2.GetDeclContextDIEs(decl_ctx_2); - // Make sure the context arrays have the same size, otherwise - // we are done + // Make sure the context arrays have the same size, otherwise we are done const size_t count1 = decl_ctx_1.Size(); const size_t count2 = decl_ctx_2.Size(); if (count1 != count2) return false; - // Make sure the DW_TAG values match all the way back up the - // compile unit. If they don't, then we are done. + // Make sure the DW_TAG values match all the way back up the compile unit. If + // they don't, then we are done. DWARFDIE decl_ctx_die1; DWARFDIE decl_ctx_die2; size_t i; @@ -3339,27 +3310,28 @@ #if defined LLDB_CONFIGURATION_DEBUG // Make sure the top item in the decl context die array is always - // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then something - // went wrong in the DWARFDIE::GetDeclContextDIEs() function... + // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then + // something went wrong in the DWARFDIE::GetDeclContextDIEs() + // function. dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag(); UNUSED_IF_ASSERT_DISABLED(cu_tag); assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit); #endif - // Always skip the compile unit when comparing by only iterating up to - // "count - 1". Here we compare the names as we go. + // Always skip the compile unit when comparing by only iterating up to "count + // - 1". Here we compare the names as we go. for (i = 0; i < count1 - 1; i++) { decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i); decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i); const char *name1 = decl_ctx_die1.GetName(); const char *name2 = decl_ctx_die2.GetName(); - // If the string was from a DW_FORM_strp, then the pointer will often - // be the same! + // If the string was from a DW_FORM_strp, then the pointer will often be + // the same! if (name1 == name2) continue; - // Name pointers are not equal, so only compare the strings - // if both are not NULL. + // Name pointers are not equal, so only compare the strings if both are not + // NULL. if (name1 && name2) { // If the strings don't compare, we are done... if (strcmp(name1, name2) != 0) @@ -3369,8 +3341,8 @@ return false; } } - // We made it through all of the checks and the declaration contexts - // are equal. + // We made it through all of the checks and the declaration contexts are + // equal. return true; } @@ -3432,10 +3404,9 @@ const size_t num_matches = die_offsets.size(); - // Get the type system that we are looking to find a type for. We will use - // this - // to ensure any matches we find are in a language that this type system - // supports + // Get the type system that we are looking to find a type for. We will + // use this to ensure any matches we find are in a language that this + // type system supports const LanguageType language = dwarf_decl_ctx.GetLanguage(); TypeSystem *type_system = (language == eLanguageTypeUnknown) ? nullptr @@ -3448,10 +3419,8 @@ if (type_die) { // Make sure type_die's langauge matches the type system we are - // looking for. - // We don't want to find a "Foo" type from Java if we are looking - // for a "Foo" - // type for C, C++, ObjC, or ObjC++. + // looking for. We don't want to find a "Foo" type from Java if we + // are looking for a "Foo" type for C, C++, ObjC, or ObjC++. if (type_system && !type_system->SupportsLanguage(type_die.GetLanguage())) continue; @@ -3465,24 +3434,23 @@ // The tags match, lets try resolving this type try_resolving_type = true; } else { - // The tags don't match, but we need to watch our for a - // forward declaration for a struct and ("struct foo") - // ends up being a class ("class foo { ... };") or - // vice versa. + // The tags don't match, but we need to watch our for a forward + // declaration for a struct and ("struct foo") ends up being a + // class ("class foo { ... };") or vice versa. switch (type_tag) { case DW_TAG_class_type: - // We had a "class foo", see if we ended up with a "struct foo { - // ... };" + // We had a "class foo", see if we ended up with a "struct foo + // { ... };" try_resolving_type = (tag == DW_TAG_structure_type); break; case DW_TAG_structure_type: - // We had a "struct foo", see if we ended up with a "class foo { - // ... };" + // We had a "struct foo", see if we ended up with a "class foo + // { ... };" try_resolving_type = (tag == DW_TAG_class_type); break; default: - // Tags don't match, don't event try to resolve - // using this type whose name matches.... + // Tags don't match, don't event try to resolve using this type + // whose name matches.... break; } } @@ -3693,8 +3661,8 @@ } } } else { - // Index if we already haven't to make sure the compile units - // get indexed and make their global DIE index list + // Index if we already haven't to make sure the compile units get + // indexed and make their global DIE index list if (!m_indexed) Index(); @@ -3910,10 +3878,9 @@ // TODO: Handle the case when DW_AT_start_scope have form // constant. The // dwarf spec is a bit ambiguous about what is the expected - // behavior in - // case the enclosing block have a non coninious address range and - // the - // DW_AT_start_scope entry have a form constant. + // behavior in case the enclosing block have a non coninious + // address range and the DW_AT_start_scope entry have a form + // constant. GetObjectFile()->GetModule()->ReportWarning( "0x%8.8" PRIx64 ": DW_AT_start_scope has unsupported form type (0x%x)\n", @@ -3958,16 +3925,15 @@ bool has_explicit_mangled = mangled != nullptr; if (!mangled) { // LLDB relies on the mangled name (DW_TAG_linkage_name or - // DW_AT_MIPS_linkage_name) to - // generate fully qualified names of global variables with commands like - // "frame var j". - // For example, if j were an int variable holding a value 4 and declared - // in a namespace - // B which in turn is contained in a namespace A, the command "frame var - // j" returns - // "(int) A::B::j = 4". If the compiler does not emit a linkage name, we - // should be able - // to generate a fully qualified name from the declaration context. + // DW_AT_MIPS_linkage_name) to generate fully qualified names + // of global variables with commands like "frame var j". For + // example, if j were an int variable holding a value 4 and + // declared in a namespace B which in turn is contained in a + // namespace A, the command "frame var j" returns + // "(int) A::B::j = 4". + // If the compiler does not emit a linkage name, we should be + // able to generate a fully qualified name from the + // declaration context. if ((parent_tag == DW_TAG_compile_unit || parent_tag == DW_TAG_partial_unit) && Language::LanguageIsCPlusPlus(die.GetLanguage())) { @@ -4017,24 +3983,21 @@ scope = eValueTypeVariableStatic; if (debug_map_symfile) { - // When leaving the DWARF in the .o files on darwin, - // when we have a global variable that wasn't initialized, - // the .o file might not have allocated a virtual - // address for the global variable. In this case it will - // have created a symbol for the global variable - // that is undefined/data and external and the value will - // be the byte size of the variable. When we do the - // address map in SymbolFileDWARFDebugMap we rely on - // having an address, we need to do some magic here - // so we can get the correct address for our global - // variable. The address for all of these entries - // will be zero, and there will be an undefined symbol - // in this object file, and the executable will have - // a matching symbol with a good address. So here we - // dig up the correct address and replace it in the - // location for the variable, and set the variable's - // symbol context scope to be that of the main executable - // so the file address will resolve correctly. + // When leaving the DWARF in the .o files on darwin, when we have a + // global variable that wasn't initialized, the .o file might not + // have allocated a virtual address for the global variable. In + // this case it will have created a symbol for the global variable + // that is undefined/data and external and the value will be the + // byte size of the variable. When we do the address map in + // SymbolFileDWARFDebugMap we rely on having an address, we need to + // do some magic here so we can get the correct address for our + // global variable. The address for all of these entries will be + // zero, and there will be an undefined symbol in this object file, + // and the executable will have a matching symbol with a good + // address. So here we dig up the correct address and replace it in + // the location for the variable, and set the variable's symbol + // context scope to be that of the main executable so the file + // address will resolve correctly. bool linked_oso_file_addr = false; if (is_external && location_DW_OP_addr == 0) { // we have a possible uninitialized extern global @@ -4066,8 +4029,7 @@ if (!linked_oso_file_addr) { // The DW_OP_addr is not zero, but it contains a .o file address - // which - // needs to be linked up correctly. + // which needs to be linked up correctly. const lldb::addr_t exe_file_addr = debug_map_symfile->LinkOSOFileAddress(this, location_DW_OP_addr); @@ -4137,16 +4099,16 @@ var_sp->SetLocationIsConstantValueData(location_is_const_value_data); } else { - // Not ready to parse this variable yet. It might be a global - // or static variable that is in a function scope and the function - // in the symbol context wasn't filled in yet + // Not ready to parse this variable yet. It might be a global or static + // variable that is in a function scope and the function in the symbol + // context wasn't filled in yet return var_sp; } } - // Cache var_sp even if NULL (the variable was just a specification or - // was missing vital information to be able to be displayed in the debugger - // (missing location due to optimization, etc)) so we don't re-parse - // this DIE over and over later... + // Cache var_sp even if NULL (the variable was just a specification or was + // missing vital information to be able to be displayed in the debugger + // (missing location due to optimization, etc)) so we don't re-parse this + // DIE over and over later... GetDIEToVariable()[die.GetDIE()] = var_sp; if (spec_die) GetDIEToVariable()[spec_die.GetDIE()] = var_sp; @@ -4254,8 +4216,8 @@ Block *block = sc.function->GetBlock(true).FindBlockByID( sc_parent_die.GetID()); if (block == NULL) { - // This must be a specification or abstract origin with - // a concrete block counterpart in the current function. We need + // This must be a specification or abstract origin with a + // concrete block counterpart in the current function. We need // to find the concrete block so we can correctly add the // variable to it const DWARFDIE concrete_block_die = Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -44,10 +44,8 @@ using namespace lldb_private; // Subclass lldb_private::Module so we can intercept the -// "Module::GetObjectFile()" -// (so we can fixup the object file sections) and also for -// "Module::GetSymbolVendor()" -// (so we can fixup the symbol file id. +// "Module::GetObjectFile()" (so we can fixup the object file sections) and +// also for "Module::GetSymbolVendor()" (so we can fixup the symbol file id. const SymbolFileDWARFDebugMap::FileRangeMap & SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( @@ -84,8 +82,8 @@ /// 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 ended up in the main executable. + // Now we need to make sections that map from zero based object file + // addresses to where things ended up in the main executable. assert(comp_unit_info->first_symbol_index != UINT32_MAX); // End index is one past the last valid symbol index @@ -104,9 +102,9 @@ break; case eSymbolTypeCode: { - // For each N_FUN, or function that we run into in the debug map - // we make a new section that we add to the sections found in the - // .o file. This new section has the file address set to what the + // For each N_FUN, or function that we run into in the debug map we + // make a new section that we add to the sections found in the .o + // file. This new section has the file address set to what the // addresses are in the .o file, and the load address is adjusted // to match where it ended up in the final executable! We do this // before we parse any dwarf info so that when it goes get parsed @@ -129,21 +127,21 @@ } break; case eSymbolTypeData: { - // For each N_GSYM we remap the address for the global by making - // a new section that we add to the sections found in the .o file. - // This new section has the file address set to what the - // addresses are in the .o file, and the load address is adjusted - // to match where it ended up in the final executable! We do this - // before we parse any dwarf info so that when it goes get parsed - // all section/offset addresses that get registered will resolve + // For each N_GSYM we remap the address for the global by making a + // new section that we add to the sections found in the .o file. + // This new section has the file address set to what the addresses + // are in the .o file, and the load address is adjusted to match + // where it ended up in the final executable! We do this 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. We // initially set the section size to be 1 byte, but will need to // 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 + // 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(lldb::eLanguageTypeUnknown, @@ -198,9 +196,9 @@ SymbolVendor *symbol_vendor = Module::GetSymbolVendor(can_create, feedback_strm); if (symbol_vendor) { - // Set a pointer to this class to set our OSO DWARF file know - // that the DWARF is being used along with a debug map and that - // it will have the remapped sections that we do below. + // Set a pointer to this class to set our OSO DWARF file know that + // the DWARF is being used along with a debug map and that it will + // have the remapped sections that we do below. SymbolFileDWARF *oso_symfile = SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF( symbol_vendor->GetSymbolFile()); @@ -292,8 +290,8 @@ // In order to get the abilities of this plug-in, we look at the list of // N_OSO entries (object files) from the symbol table and make sure that - // these files exist and also contain valid DWARF. If we get any of that - // then we return the abilities of the first N_OSO's DWARF. + // these files exist and also contain valid DWARF. If we get any of that then + // we return the abilities of the first N_OSO's DWARF. Symtab *symtab = m_obj_file->GetSymtab(); if (symtab) { @@ -303,10 +301,10 @@ // When a mach-o symbol is encoded, the n_type field is encoded in bits // 23:16, and the n_desc field is encoded in bits 15:0. // - // To find all N_OSO entries that are part of the DWARF + debug map - // we find only object file symbols with the flags value as follows: - // bits 23:16 == 0x66 (N_OSO) - // bits 15: 0 == 0x0001 (specifies this is a debug map object file) + // To find all N_OSO entries that are part of the DWARF + debug map we find + // only object file symbols with the flags value as follows: bits 23:16 == + // 0x66 (N_OSO) bits 15: 0 == 0x0001 (specifies this is a debug map object + // file) const uint32_t k_oso_symbol_flags_value = 0x660001u; const uint32_t oso_index_count = @@ -443,16 +441,15 @@ return NULL; } } - // Always create a new module for .o files. Why? Because we - // use the debug map, to add new sections to each .o file and - // even though a .o file might not have changed, the sections - // that get added to the .o file can change. + // Always create a new module for .o files. Why? Because we use the debug + // map, to add new sections to each .o file and even though a .o file + // might not have changed, the sections that get added to the .o file can + // change. ArchSpec oso_arch; // Only adopt the architecture from the module (not the vendor or OS) - // since .o files for "i386-apple-ios" will historically show up as - // "i386-apple-macosx" - // due to the lack of a LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS - // load command... + // since .o files for "i386-apple-ios" will historically show up as "i386 + // -apple-macosx" due to the lack of a LC_VERSION_MIN_MACOSX or + // LC_VERSION_MIN_IPHONEOS load command... oso_arch.SetTriple(m_obj_file->GetModule() ->GetArchitecture() .GetTriple() @@ -546,8 +543,8 @@ uint32_t SymbolFileDWARFDebugMap::CalculateAbilities() { // In order to get the abilities of this plug-in, we look at the list of // N_OSO entries (object files) from the symbol table and make sure that - // these files exist and also contain valid DWARF. If we get any of that - // then we return the abilities of the first N_OSO's DWARF. + // these files exist and also contain valid DWARF. If we get any of that then + // we return the abilities of the first N_OSO's DWARF. const uint32_t oso_index_count = GetNumCompileUnits(); if (oso_index_count > 0) { @@ -576,9 +573,8 @@ if (oso_module) { FileSpec so_file_spec; if (GetFileSpecForSO(cu_idx, so_file_spec)) { - // User zero as the ID to match the compile unit at offset - // zero in each .o file since each .o file can only have - // one compile unit for now. + // User zero as the ID to match the compile unit at offset zero in each + // .o file since each .o file can only have one compile unit for now. lldb::user_id_t cu_id = 0; m_compile_unit_infos[cu_idx].compile_unit_sp.reset( new CompileUnit(m_obj_file->GetModule(), NULL, so_file_spec, cu_id, @@ -767,8 +763,8 @@ const uint32_t cu_count = GetNumCompileUnits(); for (uint32_t i = 0; i < cu_count; ++i) { - // If we are checking for inlines, then we need to look through all - // compile units no matter if "file_spec" matches. + // If we are checking for inlines, then we need to look through all compile + // units no matter if "file_spec" matches. bool resolve = check_inlines; if (!resolve) { @@ -823,8 +819,8 @@ if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); uint32_t total_matches = 0; @@ -843,8 +839,8 @@ if (max_matches >= total_matches) return true; - // Update the max matches for any subsequent calls to find globals - // in any other object files with DWARF + // Update the max matches for any subsequent calls to find globals in any + // other object files with DWARF max_matches -= oso_matches; } @@ -863,8 +859,8 @@ if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); uint32_t total_matches = 0; @@ -882,8 +878,8 @@ if (max_matches >= total_matches) return true; - // Update the max matches for any subsequent calls to find globals - // in any other object files with DWARF + // Update the max matches for any subsequent calls to find globals in any + // other object files with DWARF max_matches -= oso_matches; } @@ -965,12 +961,12 @@ static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp, SymbolContextList &sc_list, uint32_t start_idx) { - // We found functions in .o files. Not all functions in the .o files - // will have made it into the final output file. The ones that did - // make it into the final output file will have a section whose module - // matches the module from the ObjectFile for this SymbolFile. When - // the modules don't match, then we have something that was in a - // .o file, but doesn't map to anything in the final executable. + // We found functions in .o files. Not all functions in the .o files will + // have made it into the final output file. The ones that did make it into + // the final output file will have a section whose module matches the module + // from the ObjectFile for this SymbolFile. When the modules don't match, + // then we have something that was in a .o file, but doesn't map to anything + // in the final executable. uint32_t i = start_idx; while (i < sc_list.GetSize()) { SymbolContext sc; @@ -1105,8 +1101,8 @@ // the type name and whose type is eSymbolTypeObjCClass. If we can find that // symbol and find its containing parent, we can locate the .o file that will // contain the implementation definition since it will be scoped inside the - // N_SO - // and we can then locate the SymbolFileDWARF that corresponds to that N_SO. + // N_SO and we can then locate the SymbolFileDWARF that corresponds to that + // N_SO. SymbolFileDWARF *oso_dwarf = NULL; TypeSP type_sp; ObjectFile *module_objfile = m_obj_file->GetModule()->GetObjectFile(); @@ -1118,8 +1114,7 @@ Symtab::eVisibilityAny); if (objc_class_symbol) { // Get the N_SO symbol that contains the objective C class symbol as - // this - // should be the .o file that contains the real definition... + // this should be the .o file that contains the real definition... const Symbol *source_file_symbol = symtab->GetParent(objc_class_symbol); if (source_file_symbol && @@ -1147,10 +1142,8 @@ } // Only search all .o files for the definition if we don't need the - // implementation - // because otherwise, with a valid debug map we should have the ObjC class - // symbol and - // the code above should have found it. + // implementation because otherwise, with a valid debug map we should have + // the ObjC class symbol and the code above should have found it. if (must_be_implementation == false) { TypeSP type_sp; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp @@ -27,8 +27,8 @@ udt.m_byte_size == byte_size) { // Make sure the file and line match if (udt.m_declaration == decl) { - // The type has the same name, and was defined on the same - // file and line. Now verify all of the parent DIEs match. + // The type has the same name, and was defined on the same file and + // line. Now verify all of the parent DIEs match. DWARFDIE parent_arg_die = die.GetParent(); DWARFDIE parent_pos_die = udt.m_die.GetParent(); bool match = true; Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp @@ -137,8 +137,8 @@ // represented by the one generated for `double`. break; } - // If there is no match on PDB_BuiltinType, fall back to default search - // by encoding and width only + // If there is no match on PDB_BuiltinType, fall back to default search by + // encoding and width only return clang_ast.GetBuiltinTypeForEncodingAndBitSize(encoding, width); } @@ -208,9 +208,9 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) { // PDB doesn't maintain enough information to robustly rebuild the entire - // tree, and this is most problematic when it comes to figure out the - // right DeclContext to put a type in. So for now, everything goes in - // the translation unit decl as a fully qualified type. + // tree, and this is most problematic when it comes to figure out the right + // DeclContext to put a type in. So for now, everything goes in the + // translation unit decl as a fully qualified type. clang::DeclContext *tu_decl_ctx = m_ast.GetTranslationUnitDecl(); Declaration decl; Index: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -182,13 +182,13 @@ return 0; // The linker could link *.dll (compiland language = LINK), or import - // *.dll. For example, a compiland with name `Import:KERNEL32.dll` - // could be found as a child of the global scope (PDB executable). - // Usually, such compilands contain `thunk` symbols in which we are not - // interested for now. However we still count them in the compiland list. - // If we perform any compiland related activity, like finding symbols - // through llvm::pdb::IPDBSession methods, such compilands will all be - // searched automatically no matter whether we include them or not. + // *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be + // found as a child of the global scope (PDB executable). Usually, such + // compilands contain `thunk` symbols in which we are not interested for + // now. However we still count them in the compiland list. If we perform + // any compiland related activity, like finding symbols through + // llvm::pdb::IPDBSession methods, such compilands will all be searched + // automatically no matter whether we include them or not. m_cached_compile_unit_count = compilands->getChildCount(); // The linker can inject an additional "dummy" compilation unit into the @@ -470,8 +470,8 @@ ParseTypesByTagFn(*compiland); // Also parse global types particularly coming from this compiland. - // Unfortunately, PDB has no compiland information for each global type. - // We have to parse them all. But ensure we only do this once. + // Unfortunately, PDB has no compiland information for each global type. We + // have to parse them all. But ensure we only do this once. static bool parse_all_global_types = false; if (!parse_all_global_types) { ParseTypesByTagFn(*m_global_scope_up); @@ -622,10 +622,10 @@ // For each one, either find its previously parsed data or parse it afresh // and add it to the symbol context list. while (auto compiland = compilands->getNext()) { - // If we're not checking inlines, then don't add line information for this - // file unless the FileSpec matches. - // For inline functions, we don't have to match the FileSpec since they - // could be defined in headers other than file specified in FileSpec. + // If we're not checking inlines, then don't add line information for + // this file unless the FileSpec matches. For inline functions, we don't + // have to match the FileSpec since they could be defined in headers + // other than file specified in FileSpec. if (!check_inlines) { std::string source_file = compiland->getSourceFileFullPath(); if (source_file.empty()) @@ -651,7 +651,8 @@ if ((resolve_scope & eSymbolContextLineEntry) && !has_line_table) { // The query asks for line entries, but we can't get them for the - // compile unit. This is not normal for `line` = 0. So just assert it. + // compile unit. This is not normal for `line` = 0. So just assert + // it. assert(line && "Couldn't get all line entries!\n"); // Current compiland does not have the requested line. Search next. @@ -669,8 +670,8 @@ // Skip the terminal line entry. --num_line_entries; - // If `line `!= 0, see if we can resolve function for each line - // entry in the line table. + // If `line `!= 0, see if we can resolve function for each line entry + // in the line table. for (uint32_t line_idx = 0; line && line_idx < num_line_entries; ++line_idx) { if (!line_table->GetLineEntryAtIndex(line_idx, sc.line_entry)) @@ -779,10 +780,10 @@ ConstString cstr_name(name); - // To search a method name, like NS::Class:MemberFunc, LLDB searches its - // base name, i.e. MemberFunc by default. Since PDBSymbolFunc does not - // have inforamtion of this, we extract base names and cache them by our - // own effort. + // To search a method name, like NS::Class:MemberFunc, LLDB searches + // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does + // not have inforamtion of this, we extract base names and cache them + // by our own effort. llvm::StringRef basename; CPlusPlusLanguage::MethodName cpp_method(cstr_name); if (cpp_method.IsValid()) { @@ -1040,8 +1041,8 @@ case PDB_SymType::Typedef: break; default: - // We're looking only for types that have names. Skip symbols, as well as - // unnamed types such as arrays, pointers, etc. + // We're looking only for types that have names. Skip symbols, as well + // as unnamed types such as arrays, pointers, etc. continue; } @@ -1228,8 +1229,8 @@ // LineEntry needs the *index* of the file into the list of support files // returned by ParseCompileUnitSupportFiles. But the underlying SDK gives us - // a globally unique idenfitifier in the namespace of the PDB. So, we have to - // do a mapping so that we can hand out indices. + // a globally unique idenfitifier in the namespace of the PDB. So, we have + // to do a mapping so that we can hand out indices. llvm::DenseMap index_map; BuildSupportFileIdToSupportFileIndexMap(*compiland_up, index_map); auto line_table = llvm::make_unique(sc.comp_unit); @@ -1240,8 +1241,8 @@ if (!files) return false; - // For each source and header file, create a LineSequence for contributions to - // the compiland from that file, and add the sequence. + // For each source and header file, create a LineSequence for contributions + // to the compiland from that file, and add the sequence. while (auto file = files->getNext()) { std::unique_ptr sequence( line_table->CreateLineSequenceContainer()); @@ -1265,8 +1266,8 @@ uint32_t col = line->getColumnNumber(); uint32_t source_idx = index_map[source_id]; - // There was a gap between the current entry and the previous entry if the - // addresses don't perfectly line up. + // There was a gap between the current entry and the previous entry if + // the addresses don't perfectly line up. bool is_gap = (i > 0) && (prev_addr + prev_length < addr); // Before inserting the current entry, insert a terminal entry at the end @@ -1325,8 +1326,8 @@ void SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap( const PDBSymbolCompiland &compiland, llvm::DenseMap &index_map) const { - // This is a hack, but we need to convert the source id into an index into the - // support files array. We don't want to do path comparisons to avoid + // This is a hack, but we need to convert the source id into an index into + // the support files array. We don't want to do path comparisons to avoid // basename / full path issues that may or may not even be a problem, so we // use the globally unique source file identifiers. Ideally we could use the // global identifiers everywhere, but LineEntry currently assumes indices. @@ -1400,12 +1401,12 @@ // For MSVC, format of C funciton's decorated name depends on calling // conventon. Unfortunately none of the format is recognized by current // LLDB. For example, `_purecall` is a __cdecl C function. From PDB, - // `__purecall` is retrieved as both its decorated and - // undecorated name (using PDBSymbolFunc::getUndecoratedName method). - // However `__purecall` string is not treated as mangled in LLDB - // (neither `?` nor `_Z` prefix). Mangled::GetDemangledName method - // will fail internally and caches an empty string as its undecorated - // name. So we will face a contradition here for the same symbol: + // `__purecall` is retrieved as both its decorated and undecorated name + // (using PDBSymbolFunc::getUndecoratedName method). However `__purecall` + // string is not treated as mangled in LLDB (neither `?` nor `_Z` prefix). + // Mangled::GetDemangledName method will fail internally and caches an + // empty string as its undecorated name. So we will face a contradition + // here for the same symbol: // non-empty undecorated name from PDB // empty undecorated name from LLDB if (!func_undecorated_name.empty() && @@ -1413,8 +1414,8 @@ mangled.SetDemangledName(ConstString(func_undecorated_name)); // LLDB uses several flags to control how a C++ decorated name is - // undecorated for MSVC. See `safeUndecorateName` in Class Mangled. - // So the yielded name could be different from what we retrieve from + // undecorated for MSVC. See `safeUndecorateName` in Class Mangled. So the + // yielded name could be different from what we retrieve from // PDB source unless we also apply same flags in getting undecorated // name through PDBSymbolFunc::getUndecoratedNameEx method. if (!func_undecorated_name.empty() && Index: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -63,9 +63,9 @@ const Symtab *symtab = m_obj_file->GetSymtab(); if (symtab) { //---------------------------------------------------------------------- - // The snippet of code below will get the indexes the module symbol - // table entries that are code, data, or function related (debug info), - // sort them by value (address) and dump the sorted symbols. + // The snippet of code below will get the indexes the module symbol table + // entries that are code, data, or function related (debug info), sort + // them by value (address) and dump the sorted symbols. //---------------------------------------------------------------------- if (symtab->AppendSymbolIndexesWithType(eSymbolTypeSourceFile, m_source_indexes)) { @@ -105,24 +105,21 @@ } uint32_t SymbolFileSymtab::GetNumCompileUnits() { - // If we don't have any source file symbols we will just have one compile unit - // for - // the entire object file + // If we don't have any source file symbols we will just have one compile + // unit for the entire object file if (m_source_indexes.empty()) return 0; // If we have any source file symbols we will logically organize the object - // symbols - // using these. + // symbols using these. return m_source_indexes.size(); } CompUnitSP SymbolFileSymtab::ParseCompileUnitAtIndex(uint32_t idx) { CompUnitSP cu_sp; - // If we don't have any source file symbols we will just have one compile unit - // for - // the entire object file + // If we don't have any source file symbols we will just have one compile + // unit for the entire object file if (idx < m_source_indexes.size()) { const Symbol *cu_symbol = m_obj_file->GetSymtab()->SymbolAtIndex(m_source_indexes[idx]); @@ -152,13 +149,12 @@ // // const uint32_t prefix_len = strlen(prefix); - // If we don't have any source file symbols we will just have one compile unit - // for - // the entire object file + // If we don't have any source file symbols we will just have one compile + // unit for the entire object file if (m_source_indexes.empty()) { - // The only time we will have a user ID of zero is when we don't have - // and source file symbols and we declare one compile unit for the - // entire object file + // The only time we will have a user ID of zero is when we don't have and + // source file symbols and we declare one compile unit for the entire + // object file if (!m_func_indexes.empty()) { } Index: lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp +++ lldb/trunk/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp @@ -57,9 +57,9 @@ //---------------------------------------------------------------------- // CreateInstance // -// Platforms can register a callback to use when creating symbol -// vendors to allow for complex debug information file setups, and to -// also allow for finding separate debug information files. +// Platforms can register a callback to use when creating symbol vendors to +// allow for complex debug information file setups, and to also allow for +// finding separate debug information files. //---------------------------------------------------------------------- SymbolVendor * SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp, @@ -112,11 +112,9 @@ module_sp, &dsym_fspec, 0, dsym_fspec.GetByteSize(), dsym_file_data_sp, dsym_file_data_offset); if (dsym_objfile_sp) { - // This objfile is for debugging purposes. Sadly, ObjectFileELF won't be - // able - // to figure this out consistently as the symbol file may not have - // stripped the - // code sections, etc. + // This objfile is for debugging purposes. Sadly, ObjectFileELF won't + // be able to figure this out consistently as the symbol file may not + // have stripped the code sections, etc. dsym_objfile_sp->SetType(ObjectFile::eTypeDebugInfo); SymbolVendorELF *symbol_vendor = new SymbolVendorELF(module_sp); Index: lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ lldb/trunk/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -94,9 +94,9 @@ //---------------------------------------------------------------------- // CreateInstance // -// Platforms can register a callback to use when creating symbol -// vendors to allow for complex debug information file setups, and to -// also allow for finding separate debug information files. +// Platforms can register a callback to use when creating symbol vendors to +// allow for complex debug information file setups, and to also allow for +// finding separate debug information files. //---------------------------------------------------------------------- SymbolVendor * SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, @@ -130,14 +130,14 @@ "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM", module_sp->GetFileSpec().GetPath().c_str()); - // First check to see if the module has a symbol file in mind already. - // If it does, then we MUST use that. + // First check to see if the module has a symbol file in mind already. If + // it does, then we MUST use that. FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec()); ObjectFileSP dsym_objfile_sp; if (!dsym_fspec) { - // No symbol file was specified in the module, lets try and find - // one ourselves. + // No symbol file was specified in the module, lets try and find one + // ourselves. FileSpec file_spec = obj_file->GetFileSpec(); if (!file_spec) file_spec = module_sp->GetFileSpec(); @@ -180,8 +180,7 @@ std::string DBGSourcePath; // DBGSourcePathRemapping is a dictionary in the plist - // with - // keys which are DBGBuildSourcePath file paths and + // with keys which are DBGBuildSourcePath file paths and // values which are DBGSourcePath file paths StructuredData::ObjectSP plist_sp = @@ -194,16 +193,15 @@ ->GetAsDictionary()) { // In an early version of DBGSourcePathRemapping, the - // DBGSourcePath - // values were incorrect. If we have a newer style - // DBGSourcePathRemapping, there will be a DBGVersion - // key in the plist with version 2 or higher. + // DBGSourcePath values were incorrect. If we have a + // newer style DBGSourcePathRemapping, there will be a + // DBGVersion key in the plist with version 2 or + // higher. // // If this is an old style DBGSourcePathRemapping, - // ignore the - // value half of the key-value remappings and use reuse - // the original - // gloal DBGSourcePath string. + // ignore the value half of the key-value remappings + // and use reuse the original gloal DBGSourcePath + // string. bool new_style_source_remapping_dictionary = false; bool do_truncate_remapping_names = false; std::string original_DBGSourcePath_value = @@ -253,10 +251,12 @@ } module_sp->GetSourceMappingList().Append( key, ConstString(DBGSourcePath), true); - // With version 2 of DBGSourcePathRemapping, we can chop off the - // last two filename parts from the source remapping and get a - // more general source remapping that still works. Add this as - // another option in addition to the full source path remap. + // With version 2 of DBGSourcePathRemapping, we + // can chop off the last two filename parts + // from the source remapping and get a more + // general source remapping that still works. + // Add this as another option in addition to + // the full source path remap. if (do_truncate_remapping_names) { FileSpec build_path(key.AsCString(), false); FileSpec source_path(DBGSourcePath.c_str(), false); @@ -303,9 +303,9 @@ } } - // Just create our symbol vendor using the current objfile as this is either - // an executable with no dSYM (that we could locate), an executable with - // a dSYM that has a UUID that doesn't match. + // Just create our symbol vendor using the current objfile as this is + // either an executable with no dSYM (that we could locate), an executable + // with a dSYM that has a UUID that doesn't match. symbol_vendor->AddSymbolFileRepresentation(obj_file->shared_from_this()); } return symbol_vendor; Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetItemInfoHandler.cpp @@ -119,20 +119,18 @@ } // Compile our __lldb_backtrace_recording_get_item_info() function (from the -// source above in g_get_item_info_function_code) if we don't find that function -// in the inferior -// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for -// testing.) +// source above in g_get_item_info_function_code) if we don't find that +// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g. +// this would be the case for testing.) // -// Insert the __lldb_backtrace_recording_get_item_info into the inferior process -// if needed. +// Insert the __lldb_backtrace_recording_get_item_info into the inferior +// process if needed. // // Write the get_item_info_arglist into the inferior's memory space to prepare // for the call. // // Returns the address of the arguments written down in the inferior process, -// which can be used to -// make the function call. +// which can be used to make the function call. lldb::addr_t AppleGetItemInfoHandler::SetupGetItemInfoFunction( Thread &thread, ValueList &get_item_info_arglist) { @@ -146,7 +144,8 @@ { std::lock_guard guard(m_get_item_info_function_mutex); - // First stage is to make the UtilityFunction to hold our injected function: + // First stage is to make the UtilityFunction to hold our injected + // function: if (!m_get_item_info_impl_code.get()) { if (g_get_item_info_function_code != NULL) { @@ -209,10 +208,9 @@ diagnostics.Clear(); // Now write down the argument values for this particular call. This looks - // like it might be a race condition - // if other threads were calling into here, but actually it isn't because we - // allocate a new args structure for - // this call by passing args_addr = LLDB_INVALID_ADDRESS... + // like it might be a race condition if other threads were calling into here, + // but actually it isn't because we allocate a new args structure for this + // call by passing args_addr = LLDB_INVALID_ADDRESS... if (!get_item_info_caller->WriteFunctionArguments( exe_ctx, args_addr, get_item_info_arglist, diagnostics)) { @@ -272,8 +270,7 @@ // uint64_t page_to_free_size) // Where the return_buffer argument points to a 24 byte region of memory - // already allocated by lldb in - // the inferior process. + // already allocated by lldb in the inferior process. CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp @@ -121,11 +121,10 @@ } } -// Compile our __lldb_backtrace_recording_get_pending_items() function (from the -// source above in g_get_pending_items_function_code) if we don't find that -// function in the inferior -// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for -// testing.) +// Compile our __lldb_backtrace_recording_get_pending_items() function (from +// the source above in g_get_pending_items_function_code) if we don't find that +// function in the inferior already with USE_BUILTIN_FUNCTION defined. (e.g. +// this would be the case for testing.) // // Insert the __lldb_backtrace_recording_get_pending_items into the inferior // process if needed. @@ -134,8 +133,7 @@ // prepare for the call. // // Returns the address of the arguments written down in the inferior process, -// which can be used to -// make the function call. +// which can be used to make the function call. lldb::addr_t AppleGetPendingItemsHandler::SetupGetPendingItemsFunction( Thread &thread, ValueList &get_pending_items_arglist) { @@ -212,10 +210,9 @@ } // Now write down the argument values for this particular call. This looks - // like it might be a race condition - // if other threads were calling into here, but actually it isn't because we - // allocate a new args structure for - // this call by passing args_addr = LLDB_INVALID_ADDRESS... + // like it might be a race condition if other threads were calling into here, + // but actually it isn't because we allocate a new args structure for this + // call by passing args_addr = LLDB_INVALID_ADDRESS... if (!get_pending_items_caller->WriteFunctionArguments( exe_ctx, args_addr, get_pending_items_arglist, diagnostics)) { @@ -279,8 +276,7 @@ // uint64_t page_to_free_size) // Where the return_buffer argument points to a 24 byte region of memory - // already allocated by lldb in - // the inferior process. + // already allocated by lldb in the inferior process. CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetQueuesHandler.cpp @@ -118,9 +118,9 @@ } // Construct a CompilerType for the structure that -// g_get_current_queues_function_code will return by value -// so we can extract the fields after performing the function call. -// i.e. we are getting this struct returned to us: +// g_get_current_queues_function_code will return by value so we can extract +// the fields after performing the function call. i.e. we are getting this +// struct returned to us: // // struct get_current_queues_return_values // { @@ -130,11 +130,9 @@ // }; // Compile our __lldb_backtrace_recording_get_current_queues() function (from -// the -// source above in g_get_current_queues_function_code) if we don't find that -// function in the inferior -// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for -// testing.) +// the source above in g_get_current_queues_function_code) if we don't find +// that function in the inferior already with USE_BUILTIN_FUNCTION defined. +// (e.g. this would be the case for testing.) // // Insert the __lldb_backtrace_recording_get_current_queues into the inferior // process if needed. @@ -143,8 +141,7 @@ // the call. // // Returns the address of the arguments written down in the inferior process, -// which can be used to -// make the function call. +// which can be used to make the function call. lldb::addr_t AppleGetQueuesHandler::SetupGetQueuesFunction(Thread &thread, @@ -217,10 +214,9 @@ diagnostics.Clear(); // Now write down the argument values for this particular call. This looks - // like it might be a race condition - // if other threads were calling into here, but actually it isn't because we - // allocate a new args structure for - // this call by passing args_addr = LLDB_INVALID_ADDRESS... + // like it might be a race condition if other threads were calling into here, + // but actually it isn't because we allocate a new args structure for this + // call by passing args_addr = LLDB_INVALID_ADDRESS... if (!get_queues_caller->WriteFunctionArguments( exe_ctx, args_addr, get_queues_arglist, diagnostics)) { @@ -280,8 +276,7 @@ // uint64_t page_to_free_size); // Where the return_buffer argument points to a 24 byte region of memory - // already allocated by lldb in - // the inferior process. + // already allocated by lldb in the inferior process. CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/AppleGetThreadItemInfoHandler.cpp @@ -128,11 +128,9 @@ } // Compile our __lldb_backtrace_recording_get_thread_item_info() function (from -// the -// source above in g_get_thread_item_info_function_code) if we don't find that -// function in the inferior -// already with USE_BUILTIN_FUNCTION defined. (e.g. this would be the case for -// testing.) +// the source above in g_get_thread_item_info_function_code) if we don't find +// that function in the inferior already with USE_BUILTIN_FUNCTION defined. +// (e.g. this would be the case for testing.) // // Insert the __lldb_backtrace_recording_get_thread_item_info into the inferior // process if needed. @@ -141,8 +139,7 @@ // prepare for the call. // // Returns the address of the arguments written down in the inferior process, -// which can be used to -// make the function call. +// which can be used to make the function call. lldb::addr_t AppleGetThreadItemInfoHandler::SetupGetThreadItemInfoFunction( Thread &thread, ValueList &get_thread_item_info_arglist) { @@ -221,10 +218,9 @@ diagnostics.Clear(); // Now write down the argument values for this particular call. This looks - // like it might be a race condition - // if other threads were calling into here, but actually it isn't because we - // allocate a new args structure for - // this call by passing args_addr = LLDB_INVALID_ADDRESS... + // like it might be a race condition if other threads were calling into here, + // but actually it isn't because we allocate a new args structure for this + // call by passing args_addr = LLDB_INVALID_ADDRESS... if (!get_thread_item_info_caller->WriteFunctionArguments( exe_ctx, args_addr, get_thread_item_info_arglist, diagnostics)) { @@ -266,8 +262,7 @@ // Set up the arguments for a call to - // struct get_thread_item_info_return_values - // { + // struct get_thread_item_info_return_values { // uint64_t item_info_buffer_ptr; /* the address of the items buffer // from libBacktraceRecording */ // uint64_t item_info_buffer_size; /* the size of the items buffer from @@ -283,8 +278,7 @@ // uint64_t page_to_free_size) // Where the return_buffer argument points to a 24 byte region of memory - // already allocated by lldb in - // the inferior process. + // already allocated by lldb in the inferior process. CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType(); Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp =================================================================== --- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -34,9 +34,9 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Create an instance of this class. This function is filled into -// the plugin info class that gets handed out by the plugin factory and -// allows the lldb to instantiate an instance of this class. +// Create an instance of this class. This function is filled into the plugin +// info class that gets handed out by the plugin factory and allows the lldb to +// instantiate an instance of this class. //---------------------------------------------------------------------- SystemRuntime *SystemRuntimeMacOSX::CreateInstance(Process *process) { bool create = false; @@ -125,17 +125,15 @@ ReadLibdispatchOffsets(); if (m_libdispatch_offsets.IsValid()) { // dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a - // thread - - // deref it to get the address of the dispatch_queue_t structure for this - // thread's - // queue. + // thread - deref it to get the address of the dispatch_queue_t structure + // for this thread's queue. Status error; addr_t dispatch_queue_addr = m_process->ReadPointerFromMemory(dispatch_qaddr, error); if (error.Success()) { if (m_libdispatch_offsets.dqo_version >= 4) { - // libdispatch versions 4+, pointer to dispatch name is in the - // queue structure. + // libdispatch versions 4+, pointer to dispatch name is in the queue + // structure. addr_t pointer_to_label_address = dispatch_queue_addr + m_libdispatch_offsets.dqo_label; addr_t label_addr = @@ -248,10 +246,8 @@ ReadLibdispatchOffsets(); if (m_libdispatch_offsets.IsValid()) { // dispatch_qaddr is from a thread_info(THREAD_IDENTIFIER_INFO) call for a - // thread - - // deref it to get the address of the dispatch_queue_t structure for this - // thread's - // queue. + // thread - deref it to get the address of the dispatch_queue_t structure + // for this thread's queue. Status error; uint64_t dispatch_queue_addr = m_process->ReadPointerFromMemory(dispatch_qaddr, error); @@ -287,8 +283,8 @@ dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType( g_dispatch_queue_offsets_symbol_name, eSymbolTypeData); - // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") and - // later + // libdispatch symbols are in their own dylib as of Mac OS X 10.7 ("Lion") + // and later if (dispatch_queue_offsets_symbol == NULL) { ModuleSpec libdispatch_module_spec(FileSpec("libdispatch.dylib", false)); module_sp = m_process->GetTarget().GetImages().FindFirstModule( @@ -320,8 +316,7 @@ lldb::offset_t data_offset = 0; // The struct LibdispatchOffsets is a series of uint16_t's - extract them - // all - // in one big go. + // all in one big go. data.GetU16(&data_offset, &m_libdispatch_offsets.dqo_version, sizeof(struct LibdispatchOffsets) / sizeof(uint16_t)); } @@ -368,8 +363,7 @@ lldb::offset_t data_offset = 0; // The struct LibpthreadOffsets is a series of uint16_t's - extract them - // all - // in one big go. + // all in one big go. data.GetU16(&data_offset, &m_libpthread_offsets.plo_version, sizeof(struct LibpthreadOffsets) / sizeof(uint16_t)); } @@ -407,10 +401,8 @@ if (m_dispatch_tsd_indexes_addr != LLDB_INVALID_ADDRESS) { // We don't need to check the version number right now, it will be at least 2, -// but -// keep this code around to fetch just the version # for the future where we -// need -// to fetch alternate versions of the struct. +// but keep this code around to fetch just the version # for the future where +// we need to fetch alternate versions of the struct. #if 0 uint16_t dti_version = 2; Address dti_struct_addr; @@ -473,12 +465,9 @@ Status error; // real_thread is either an actual, live thread (in which case we need to - // call into - // libBacktraceRecording to find its originator) or it is an extended - // backtrace itself, - // in which case we get the token from it and call into - // libBacktraceRecording to find - // the originator of that token. + // call into libBacktraceRecording to find its originator) or it is an + // extended backtrace itself, in which case we get the token from it and + // call into libBacktraceRecording to find the originator of that token. if (real_thread->GetExtendedBacktraceToken() != LLDB_INVALID_ADDRESS) { originating_thread_sp = GetExtendedBacktraceFromItemRef( @@ -735,13 +724,11 @@ } // We either didn't have libBacktraceRecording (and need to create the queues - // list based on threads) - // or we did get the queues list from libBacktraceRecording but some special - // queues may not be - // included in its information. This is needed because libBacktraceRecording - // will only list queues with pending or running items by default - but the - // magic com.apple.main-thread - // queue on thread 1 is always around. + // list based on threads) or we did get the queues list from + // libBacktraceRecording but some special queues may not be included in its + // information. This is needed because libBacktraceRecording will only list + // queues with pending or running items by default - but the magic com.apple + // .main-thread queue on thread 1 is always around. for (ThreadSP thread_sp : m_process->Threads()) { if (thread_sp->GetAssociatedWithLibdispatchQueue() != eLazyBoolNo) { @@ -769,12 +756,10 @@ } // Returns either an array of introspection_dispatch_item_info_ref's for the -// pending items on -// a queue or an array introspection_dispatch_item_info_ref's and code addresses -// for the -// pending items on a queue. The information about each of these pending items -// then needs to -// be fetched individually by passing the ref to libBacktraceRecording. +// pending items on a queue or an array introspection_dispatch_item_info_ref's +// and code addresses for the pending items on a queue. The information about +// each of these pending items then needs to be fetched individually by passing +// the ref to libBacktraceRecording. SystemRuntimeMacOSX::PendingItemsForQueue SystemRuntimeMacOSX::GetPendingItemRefsForQueue(lldb::addr_t queue) { @@ -927,8 +912,8 @@ offset_t offset = 0; uint64_t queues_read = 0; - // The information about the queues is stored in this format (v1): - // typedef struct introspection_dispatch_queue_info_s { + // The information about the queues is stored in this format (v1): typedef + // struct introspection_dispatch_queue_info_s { // uint32_t offset_to_next; // dispatch_queue_t queue; // uint64_t serialnum; // queue's serialnum in the process, as Index: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp =================================================================== --- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -58,8 +58,8 @@ if (range.GetByteSize() > 0 && range.GetBaseAddress().IsValid() && m_inst_emulator_ap.get()) { - // The instruction emulation subclass setup the unwind plan for the - // first instruction. + // The instruction emulation subclass setup the unwind plan for the first + // instruction. m_inst_emulator_ap->CreateFunctionEntryUnwind(unwind_plan); // CreateFunctionEntryUnwind should have created the first row. If it @@ -90,9 +90,9 @@ m_register_values.clear(); m_pushed_regs.clear(); - // Initialize the CFA with a known value. In the 32 bit case - // it will be 0x80000000, and in the 64 bit case 0x8000000000000000. - // We use the address byte size to be safe for any future address sizes + // Initialize the CFA with a known value. In the 32 bit case it will be + // 0x80000000, and in the 64 bit case 0x8000000000000000. We use the + // address byte size to be safe for any future address sizes m_initial_sp = (1ull << ((addr_byte_size * 8) - 1)); RegisterValue cfa_reg_value; cfa_reg_value.SetUInt(m_initial_sp, m_cfa_reg_info.byte_size); @@ -105,14 +105,12 @@ Instruction *inst = inst_list.GetInstructionAtIndex(0).get(); const lldb::addr_t base_addr = inst->GetAddress().GetFileAddress(); - // Map for storing the unwind plan row and the value of the registers at - // a given offset. - // When we see a forward branch we add a new entry to this map with the - // actual unwind plan - // row and register context for the target address of the branch as the - // current data have - // to be valid for the target address of the branch too if we are in the - // same function. + // Map for storing the unwind plan row and the value of the registers + // at a given offset. When we see a forward branch we add a new entry + // to this map with the actual unwind plan row and register context for + // the target address of the branch as the current data have to be + // valid for the target address of the branch too if we are in the same + // function. std::map> saved_unwind_states; @@ -128,15 +126,14 @@ saved_unwind_states.insert({0, {last_row, m_register_values}}); // cache the pc register number (in whatever register numbering this - // UnwindPlan uses) for - // quick reference during instruction parsing. + // UnwindPlan uses) for quick reference during instruction parsing. RegisterInfo pc_reg_info; m_inst_emulator_ap->GetRegisterInfo( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc_reg_info); // cache the return address register number (in whatever register - // numbering this UnwindPlan uses) for - // quick reference during instruction parsing. + // numbering this UnwindPlan uses) for quick reference during + // instruction parsing. RegisterInfo ra_reg_info; m_inst_emulator_ap->GetRegisterInfo( eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA, ra_reg_info); @@ -160,12 +157,11 @@ "Unwind row for the function entry missing"); --it; // Move it to the row corresponding to the current offset - // If the offset of m_curr_row don't match with the offset we see in - // saved_unwind_states - // then we have to update m_curr_row and m_register_values based on - // the saved values. It - // is happenning after we processed an epilogue and a return to - // caller instruction. + // If the offset of m_curr_row don't match with the offset we see + // in saved_unwind_states then we have to update m_curr_row and + // m_register_values based on the saved values. It is happenning + // after we processed an epilogue and a return to caller + // instruction. if (it->second.first->GetOffset() != m_curr_row->GetOffset()) { UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *it->second.first; @@ -181,10 +177,9 @@ if (m_inst_emulator_ap->GetInstructionCondition() != EmulateInstruction::UnconditionalCondition && saved_unwind_states.count(current_offset) == 0) { - // If we don't have a saved row for the current offset then save - // our - // current state because we will have to restore it after the - // conditional block. + // If we don't have a saved row for the current offset then + // save our current state because we will have to restore it + // after the conditional block. auto new_row = std::make_shared(*m_curr_row.get()); saved_unwind_states.insert( @@ -192,8 +187,8 @@ } // If the last instruction was conditional with a different - // condition - // then the then current condition then restore the condition. + // condition then the then current condition then restore the + // condition. if (last_condition != EmulateInstruction::UnconditionalCondition) { const auto &saved_state = @@ -230,8 +225,7 @@ eEmulateInstructionOptionIgnoreConditions); // If the current instruction is a branch forward then save the - // current CFI information - // for the offset where we are branching. + // current CFI information for the offset where we are branching. if (m_forward_branch_offset != 0 && range.ContainsFileAddress(inst->GetAddress().GetFileAddress() + m_forward_branch_offset)) { @@ -247,8 +241,8 @@ // Were there any changes to the CFI while evaluating this // instruction? if (m_curr_row_modified) { - // Save the modified row if we don't already have a CFI row in the - // currennt address + // Save the modified row if we don't already have a CFI row in + // the currennt address if (saved_unwind_states.count( current_offset + inst->GetOpcode().GetByteSize()) == 0) { m_curr_row->SetOffset(current_offset + Index: lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp =================================================================== --- lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp +++ lldb/trunk/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp @@ -86,12 +86,10 @@ LLDB_REGNUM_GENERIC_PC); // Does this UnwindPlan describe the prologue? I want to see that the CFA is - // set - // in terms of the stack pointer plus an offset, and I want to see that rip is - // retrieved at the CFA-wordsize. - // If there is no description of the prologue, don't try to augment this - // eh_frame - // unwinder code, fall back to assembly parsing instead. + // set in terms of the stack pointer plus an offset, and I want to see that + // rip is retrieved at the CFA-wordsize. If there is no description of the + // prologue, don't try to augment this eh_frame unwinder code, fall back to + // assembly parsing instead. if (first_row->GetCFAValue().GetValueType() != UnwindPlan::Row::CFAValue::isRegisterPlusOffset || @@ -110,14 +108,13 @@ return false; } - // It looks like the prologue is described. - // Is the epilogue described? If it is, no need to do any augmentation. + // It looks like the prologue is described. Is the epilogue described? If it + // is, no need to do any augmentation. if (first_row != last_row && first_row->GetOffset() != last_row->GetOffset()) { - // The first & last row have the same CFA register - // and the same CFA offset value - // and the CFA register is esp/rsp (the stack pointer). + // The first & last row have the same CFA register and the same CFA offset + // value and the CFA register is esp/rsp (the stack pointer). // We're checking that both of them have an unwind rule like "CFA=esp+4" or // CFA+rsp+8". @@ -128,8 +125,8 @@ last_row->GetCFAValue().GetRegisterNumber() && first_row->GetCFAValue().GetOffset() == last_row->GetCFAValue().GetOffset()) { - // Get the register locations for eip/rip from the first & last rows. - // Are they both CFA plus an offset? Is it the same offset? + // Get the register locations for eip/rip from the first & last rows. Are + // they both CFA plus an offset? Is it the same offset? UnwindPlan::Row::RegisterLocation last_row_pc_loc; if (last_row->GetRegisterInfo( @@ -139,12 +136,10 @@ first_row_pc_loc.GetOffset() == last_row_pc_loc.GetOffset()) { // One last sanity check: Is the unwind rule for getting the caller - // pc value - // "deref the CFA-4" or "deref the CFA-8"? + // pc value "deref the CFA-4" or "deref the CFA-8"? // If so, we have an UnwindPlan that already describes the epilogue - // and we don't need - // to modify it at all. + // and we don't need to modify it at all. if (first_row_pc_loc.GetOffset() == -wordsize) { do_augment_unwindplan = false; Index: lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp =================================================================== --- lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp +++ lldb/trunk/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp @@ -246,8 +246,7 @@ } // This function expects an x86 native register number (i.e. the bits stripped -// out of the -// actual instruction), not an lldb register number. +// out of the actual instruction), not an lldb register number. // // FIXME: This is ABI dependent, it shouldn't be hardcoded here. @@ -321,15 +320,14 @@ // pushl imm8(%esp) // -// e.g. 0xff 0x74 0x24 0x20 - 'pushl 0x20(%esp)' -// (same byte pattern for 'pushq 0x20(%rsp)' in an x86_64 program) +// e.g. 0xff 0x74 0x24 0x20 - 'pushl 0x20(%esp)' (same byte pattern for 'pushq +// 0x20(%rsp)' in an x86_64 program) // -// 0xff (with opcode bits '6' in next byte, PUSH r/m32) -// 0x74 (ModR/M byte with three bits used to specify the opcode) +// 0xff (with opcode bits '6' in next byte, PUSH r/m32) 0x74 (ModR/M byte with +// three bits used to specify the opcode) // mod == b01, opcode == b110, R/M == b100 // "+disp8" -// 0x24 (SIB byte - scaled index = 0, r32 == esp) -// 0x20 imm8 value +// 0x24 (SIB byte - scaled index = 0, r32 == esp) 0x20 imm8 value bool x86AssemblyInspectionEngine::push_extended_pattern_p() { if (*m_cur_insn == 0xff) { @@ -337,9 +335,8 @@ uint8_t opcode = (*(m_cur_insn + 1) >> 3) & 7; if (opcode == 6) { // I'm only looking for 0xff /6 here - I - // don't really care what value is being pushed, - // just that we're pushing a 32/64 bit value on - // to the stack is enough. + // don't really care what value is being pushed, just that we're pushing + // a 32/64 bit value on to the stack is enough. return true; } } @@ -377,8 +374,8 @@ return false; } -// movq %rsp, %rbp [0x48 0x8b 0xec] or [0x48 0x89 0xe5] -// movl %esp, %ebp [0x8b 0xec] or [0x89 0xe5] +// movq %rsp, %rbp [0x48 0x8b 0xec] or [0x48 0x89 0xe5] movl %esp, %ebp [0x8b +// 0xec] or [0x89 0xe5] bool x86AssemblyInspectionEngine::mov_rsp_rbp_pattern_p() { uint8_t *p = m_cur_insn; if (m_wordsize == 8 && *p == 0x48) @@ -529,16 +526,16 @@ (*(p + 3) == 0x0) && (*(p + 4) == 0x0); } -// Look for an instruction sequence storing a nonvolatile register -// on to the stack frame. +// Look for an instruction sequence storing a nonvolatile register on to the +// stack frame. // movq %rax, -0x10(%rbp) [0x48 0x89 0x45 0xf0] // movl %eax, -0xc(%ebp) [0x89 0x45 0xf4] -// The offset value returned in rbp_offset will be positive -- -// but it must be subtraced from the frame base register to get -// the actual location. The positive value returned for the offset -// is a convention used elsewhere for CFA offsets et al. +// The offset value returned in rbp_offset will be positive -- but it must be +// subtraced from the frame base register to get the actual location. The +// positive value returned for the offset is a convention used elsewhere for +// CFA offsets et al. bool x86AssemblyInspectionEngine::mov_reg_to_local_stack_frame_p( int ®no, int &rbp_offset) { @@ -550,8 +547,8 @@ src_reg_prefix_bit = REX_W_SRCREG(*p) << 3; target_reg_prefix_bit = REX_W_DSTREG(*p) << 3; if (target_reg_prefix_bit == 1) { - // rbp/ebp don't need a prefix bit - we know this isn't the - // reg we care about. + // rbp/ebp don't need a prefix bit - we know this isn't the reg we care + // about. return false; } p++; @@ -671,18 +668,16 @@ *newrow = *row.get(); row.reset(newrow); - // Track which registers have been saved so far in the prologue. - // If we see another push of that register, it's not part of the prologue. - // The register numbers used here are the machine register #'s - // (i386_register_numbers, x86_64_register_numbers). + // Track which registers have been saved so far in the prologue. If we see + // another push of that register, it's not part of the prologue. The register + // numbers used here are the machine register #'s (i386_register_numbers, + // x86_64_register_numbers). std::vector saved_registers(32, false); // Once the prologue has completed we'll save a copy of the unwind - // instructions - // If there is an epilogue in the middle of the function, after that epilogue - // we'll reinstate - // the unwind setup -- we assume that some code path jumps over the - // mid-function epilogue + // instructions If there is an epilogue in the middle of the function, after + // that epilogue we'll reinstate the unwind setup -- we assume that some code + // path jumps over the mid-function epilogue UnwindPlan::RowSP prologue_completed_row; // copy of prologue row of CFI int prologue_completed_sp_bytes_offset_from_cfa; // The sp value before the @@ -723,9 +718,8 @@ } // This is the start() function (or a pthread equivalent), it starts with a - // pushl $0x0 which puts the - // saved pc value of 0 on the stack. In this case we want to pretend we - // didn't see a stack movement at all -- + // pushl $0x0 which puts the saved pc value of 0 on the stack. In this + // case we want to pretend we didn't see a stack movement at all -- // normally the saved pc value is already on the stack by the time the // function starts executing. else if (push_0_pattern_p()) { @@ -733,9 +727,9 @@ else if (push_reg_p(machine_regno)) { current_sp_bytes_offset_from_cfa += m_wordsize; - // the PUSH instruction has moved the stack pointer - if the CFA is set in - // terms of the stack pointer, - // we need to add a new row of instructions. + // the PUSH instruction has moved the stack pointer - if the CFA is set + // in terms of the stack pointer, we need to add a new row of + // instructions. if (row->GetCFAValue().GetRegisterNumber() == m_lldb_sp_regnum) { row->GetCFAValue().SetOffset(current_sp_bytes_offset_from_cfa); row_updated = true; @@ -772,8 +766,7 @@ } // the POP instruction has moved the stack pointer - if the CFA is set in - // terms of the stack pointer, - // we need to add a new row of instructions. + // terms of the stack pointer, we need to add a new row of instructions. if (row->GetCFAValue().GetRegisterNumber() == m_lldb_sp_regnum) { row->GetCFAValue().SetIsRegisterPlusOffset( m_lldb_sp_regnum, current_sp_bytes_offset_from_cfa); @@ -790,13 +783,13 @@ } } - // The LEAVE instruction moves the value from rbp into rsp and pops - // a value off the stack into rbp (restoring the caller's rbp value). - // It is the opposite of ENTER, or 'push rbp, mov rsp rbp'. + // The LEAVE instruction moves the value from rbp into rsp and pops a value + // off the stack into rbp (restoring the caller's rbp value). It is the + // opposite of ENTER, or 'push rbp, mov rsp rbp'. else if (leave_pattern_p()) { // We're going to copy the value in rbp into rsp, so re-set the sp offset - // based on the CFAValue. Also, adjust it to recognize that we're popping - // the saved rbp value off the stack. + // based on the CFAValue. Also, adjust it to recognize that we're + // popping the saved rbp value off the stack. current_sp_bytes_offset_from_cfa = row->GetCFAValue().GetOffset(); current_sp_bytes_offset_from_cfa -= m_wordsize; row->GetCFAValue().SetOffset(current_sp_bytes_offset_from_cfa); @@ -822,12 +815,11 @@ UnwindPlan::Row::RegisterLocation regloc; - // stack_offset for 'movq %r15, -80(%rbp)' will be 80. - // In the Row, we want to express this as the offset from the CFA. If the - // frame base - // is rbp (like the above instruction), the CFA offset for rbp is probably - // 16. So we - // want to say that the value is stored at the CFA address - 96. + // stack_offset for 'movq %r15, -80(%rbp)' will be 80. In the Row, we + // want to express this as the offset from the CFA. If the frame base is + // rbp (like the above instruction), the CFA offset for rbp is probably + // 16. So we want to say that the value is stored at the CFA address - + // 96. regloc.SetAtCFAPlusOffset( -(stack_offset + row->GetCFAValue().GetOffset())); @@ -879,8 +871,8 @@ } else if (ret_pattern_p() && prologue_completed_row.get()) { - // Reinstate the saved prologue setup for any instructions - // that come after the ret instruction + // Reinstate the saved prologue setup for any instructions that come + // after the ret instruction UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *prologue_completed_row.get(); @@ -960,16 +952,15 @@ if (!addr_start.IsValid()) return false; - // We either need a live RegisterContext, or we need the UnwindPlan to already - // be in the lldb register numbering scheme. + // We either need a live RegisterContext, or we need the UnwindPlan to + // already be in the lldb register numbering scheme. if (reg_ctx.get() == nullptr && unwind_plan.GetRegisterKind() != eRegisterKindLLDB) return false; // Is original unwind_plan valid? - // unwind_plan should have at least one row which is ABI-default (CFA register - // is sp), - // and another row in mid-function. + // unwind_plan should have at least one row which is ABI-default (CFA + // register is sp), and another row in mid-function. if (unwind_plan.GetRowCount() < 2) return false; @@ -994,11 +985,9 @@ UnwindPlan::RowSP row(new UnwindPlan::Row(*first_row)); m_cur_insn = data + offset; - // After a mid-function epilogue we will need to re-insert the original unwind - // rules - // so unwinds work for the remainder of the function. These aren't common - // with clang/gcc - // on x86 but it is possible. + // After a mid-function epilogue we will need to re-insert the original + // unwind rules so unwinds work for the remainder of the function. These + // aren't common with clang/gcc on x86 but it is possible. bool reinstate_unwind_state = false; while (offset < size) { @@ -1015,8 +1004,7 @@ offset += insn_len; m_cur_insn = data + offset; - // offset is pointing beyond the bounds of the - // function; stop looping. + // offset is pointing beyond the bounds of the function; stop looping. if (offset >= size) continue; @@ -1044,9 +1032,8 @@ } if (row_id == 0) { - // If we are here, compiler didn't generate CFI for prologue. - // This won't happen to GCC or clang. - // In this case, bail out directly. + // If we are here, compiler didn't generate CFI for prologue. This won't + // happen to GCC or clang. In this case, bail out directly. return false; } @@ -1086,10 +1073,9 @@ } if (pop_reg_p(regno)) { // Technically, this might be a nonvolatile register recover in - // epilogue. - // We should reset RegisterInfo for the register. - // But in practice, previous rule for the register is still valid... - // So we ignore this case. + // epilogue. We should reset RegisterInfo for the register. But in + // practice, previous rule for the register is still valid... So we + // ignore this case. row->SetOffset(offset); row->GetCFAValue().IncOffset(-m_wordsize); Index: lldb/trunk/source/Symbol/ArmUnwindInfo.cpp =================================================================== --- lldb/trunk/source/Symbol/ArmUnwindInfo.cpp +++ lldb/trunk/source/Symbol/ArmUnwindInfo.cpp @@ -65,17 +65,16 @@ } // Sort the entries in the exidx section. The entries should be sorted inside - // the section but - // some old compiler isn't sorted them. + // the section but some old compiler isn't sorted them. std::sort(m_exidx_entries.begin(), m_exidx_entries.end()); } ArmUnwindInfo::~ArmUnwindInfo() {} -// Read a byte from the unwind instruction stream with the given offset. -// Custom function is required because have to red in order of significance -// within their containing -// word (most significant byte first) and in increasing word address order. +// Read a byte from the unwind instruction stream with the given offset. Custom +// function is required because have to red in order of significance within +// their containing word (most significant byte first) and in increasing word +// address order. uint8_t ArmUnwindInfo::GetByteAtOffset(const uint32_t *data, uint16_t offset) const { uint32_t value = data[offset / 4]; @@ -276,8 +275,8 @@ return false; } else if ((byte1 & 0xff) == 0xc8) { // 11001000 sssscccc - // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved (as - // if) by FSTMFDD (see remarks d,e) + // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved + // (as if) by FSTMFDD (see remarks d,e) if (byte_offset >= byte_count) return false; Index: lldb/trunk/source/Symbol/Block.cpp =================================================================== --- lldb/trunk/source/Symbol/Block.cpp +++ lldb/trunk/source/Symbol/Block.cpp @@ -60,8 +60,7 @@ if (depth < 0) { Block *parent = GetParent(); if (parent) { - // We have a depth that is less than zero, print our parent blocks - // first + // We have a depth that is less than zero, print our parent blocks first parent->Dump(s, base_addr, depth + 1, show_context); } } Index: lldb/trunk/source/Symbol/ClangASTContext.cpp =================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp +++ lldb/trunk/source/Symbol/ClangASTContext.cpp @@ -163,8 +163,8 @@ #undef OPERATOR_PREFIX #undef OPERATOR_PREFIX_LENGTH - // This is an operator, set the overloaded operator kind to invalid - // in case this is a conversion operator... + // This is an operator, set the overloaded operator kind to invalid in case + // this is a conversion operator... op_kind = clang::NUM_OVERLOADED_OPERATORS; switch (post_op_name[0]) { @@ -375,9 +375,9 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) { // FIXME: Cleanup per-file based stuff. - // Set some properties which depend solely on the input kind; it would be nice - // to move these to the language standard, and have the driver resolve the - // input kind + language standard. + // Set some properties which depend solely on the input kind; it would be + // nice to move these to the language standard, and have the driver resolve + // the input kind + language standard. if (IK.getLanguage() == InputKind::Asm) { Opts.AsmPreprocessor = 1; } else if (IK.isObjectiveC()) { @@ -440,8 +440,8 @@ Opts.setValueVisibilityMode(DefaultVisibility); - // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs - // is specified, or -std is set to a conforming mode. + // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs is + // specified, or -std is set to a conforming mode. Opts.Trigraphs = !Opts.GNUMode; Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault(); Opts.OptimizeSize = 0; @@ -662,8 +662,8 @@ m_ast_ap->getDiagnostics().setClient(getDiagnosticConsumer(), false); // This can be NULL if we don't know anything about the architecture or if - // the - // target for an architecture isn't enabled in the llvm/clang that we built + // the target for an architecture isn't enabled in the llvm/clang that we + // built TargetInfo *target_info = getTargetInfo(); if (target_info) m_ast_ap->InitBuiltinTypes(*target_info); @@ -1254,8 +1254,8 @@ } CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) { - // No need to call the getASTContext() accessor (which can create the AST - // if it isn't created yet, because we can't have created a decl in this + // No need to call the getASTContext() accessor (which can create the AST if + // it isn't created yet, because we can't have created a decl in this // AST if our AST didn't already exist... ASTContext *ast = &decl->getASTContext(); if (ast) @@ -1264,8 +1264,8 @@ } CompilerType ClangASTContext::GetTypeForDecl(ObjCInterfaceDecl *decl) { - // No need to call the getASTContext() accessor (which can create the AST - // if it isn't created yet, because we can't have created a decl in this + // No need to call the getASTContext() accessor (which can create the AST if + // it isn't created yet, because we can't have created a decl in this // AST if our AST didn't already exist... ASTContext *ast = &decl->getASTContext(); if (ast) @@ -1294,9 +1294,9 @@ } // NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and - // we will need to update this code. I was told to currently always use - // the CXXRecordDecl class since we often don't know from debug information - // if something is struct or a class, so we default to always use the more + // we will need to update this code. I was told to currently always use the + // CXXRecordDecl class since we often don't know from debug information if + // something is struct or a class, so we default to always use the more // complete definition just in case. bool is_anonymous = (!name) || (!name[0]); @@ -1499,9 +1499,9 @@ ast, template_param_infos, template_param_decls); // LLDB needs to create those decls only to be able to display a - // type that includes a template template argument. Only the name - // matters for this purpose, so we use dummy values for the other - // characterisitcs of the type. + // type that includes a template template argument. Only the name matters for + // this purpose, so we use dummy values for the other characterisitcs of the + // type. return TemplateTemplateParmDecl::Create( *ast, decl_ctx, SourceLocation(), /*Depth*/ 0, /*Position*/ 0, @@ -1933,11 +1933,10 @@ return DeclarationName(&getASTContext()->Idents.get( name)); // Not operator, but a regular function. - // Check the number of operator parameters. Sometimes we have - // seen bad DWARF that doesn't correctly describe operators and - // if we try to create a method and add it to the class, clang - // will assert and crash, so we need to make sure things are - // acceptable. + // Check the number of operator parameters. Sometimes we have seen bad DWARF + // that doesn't correctly describe operators and if we try to create a method + // and add it to the class, clang will assert and crash, so we need to make + // sure things are acceptable. clang::QualType method_qual_type(ClangUtil::GetQualType(function_clang_type)); const clang::FunctionProtoType *function_type = llvm::dyn_cast(method_qual_type.getTypePtr()); @@ -2247,8 +2246,8 @@ if (lhs_decl_kind == rhs_decl_kind) { //------------------------------------------------------------------ - // Now check that the decl contexts kinds are all equivalent - // before we have to check any names of the decl contexts... + // Now check that the decl contexts kinds are all equivalent before we + // have to check any names of the decl contexts... //------------------------------------------------------------------ clang::DeclContext *lhs_decl_ctx = lhs_decl->getDeclContext(); clang::DeclContext *rhs_decl_ctx = rhs_decl->getDeclContext(); @@ -2290,8 +2289,8 @@ return false; //-------------------------------------------------------------- - // We know that the decl context kinds all match, so now we need - // to make sure the names match as well + // We know that the decl context kinds all match, so now we need to + // make sure the names match as well //-------------------------------------------------------------- lhs_decl_ctx = lhs_decl->getDeclContext(); rhs_decl_ctx = rhs_decl->getDeclContext(); @@ -2561,8 +2560,7 @@ clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (class_interface_decl->getDefinition()) return true; @@ -2882,8 +2880,8 @@ if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer)) { if (pointee_or_element_clang_type.IsCharType()) { if (type_flags.Test(eTypeIsArray)) { - // We know the size of the array and it could be a C string - // since it is an array of characters + // We know the size of the array and it could be a C string since it is + // an array of characters length = llvm::cast( GetCanonicalQualType(type).getTypePtr()) ->getSize() @@ -3623,9 +3621,8 @@ if (success) { // Check to make sure what we are pointing too is a possible dynamic C++ - // type - // We currently accept any "void *" (in case we have a class that has been - // watered down to an opaque pointer) and virtual C++ classes. + // type We currently accept any "void *" (in case we have a class that + // has been watered down to an opaque pointer) and virtual C++ classes. const clang::Type::TypeClass pointee_type_class = pointee_qual_type.getCanonicalType()->getTypeClass(); switch (pointee_type_class) { @@ -4777,9 +4774,8 @@ } // Check whether this declaration is an anonymous struct, union, or enum, - // hidden behind a typedef. If so, we - // try to check whether we have a typedef tag to attach to the original - // record declaration + // hidden behind a typedef. If so, we try to check whether we have a + // typedef tag to attach to the original record declaration if (tdecl && !tdecl->getIdentifier() && !tdecl->getTypedefNameForAnonDecl()) tdecl->setTypedefNameForAnonDecl(decl); @@ -5005,9 +5001,8 @@ break; } break; - // All pointer types are represented as unsigned integer encodings. - // We may nee to add a eEncodingPointer if we ever need to know the - // difference + // All pointer types are represented as unsigned integer encodings. We may + // nee to add a eEncodingPointer if we ever need to know the difference case clang::Type::ObjCObjectPointer: case clang::Type::BlockPointer: case clang::Type::Pointer: @@ -5324,10 +5319,9 @@ llvm::dyn_cast(record_decl); if (cxx_record_decl) { if (omit_empty_base_classes) { - // Check each base classes to see if it or any of its - // base classes contain any fields. This can help - // limit the noise in variable views by not having to - // show base classes that contain no members. + // Check each base classes to see if it or any of its base classes + // contain any fields. This can help limit the noise in variable + // views by not having to show base classes that contain no members. clang::CXXRecordDecl::base_class_const_iterator base_class, base_class_end; for (base_class = cxx_record_decl->bases_begin(), @@ -5420,8 +5414,8 @@ CompilerType(getASTContext(), pointee_type) .GetNumChildren(omit_empty_base_classes); if (num_pointee_children == 0) { - // We have a pointer to a pointee type that claims it has no children. - // We will want to look at + // We have a pointer to a pointee type that claims it has no children. We + // will want to look at num_children = GetNumPointeeChildren(pointee_type); } else num_children = num_pointee_children; @@ -6615,15 +6609,12 @@ child_byte_size = ivar_type_info.Width / 8; // Figure out the field offset within the current - // struct/union/class type - // For ObjC objects, we can't trust the bit offset we get from - // the Clang AST, since - // that doesn't account for the space taken up by unbacked - // properties, or from - // the changing size of base classes that are newer than this - // class. - // So if we have a process around that we can ask about this - // object, do so. + // struct/union/class type For ObjC objects, we can't trust the + // bit offset we get from the Clang AST, since that doesn't + // account for the space taken up by unbacked properties, or + // from the changing size of base classes that are newer than + // this class. So if we have a process around that we can ask + // about this object, do so. child_byte_offset = LLDB_INVALID_IVAR_OFFSET; Process *process = nullptr; if (exe_ctx) @@ -6651,9 +6642,8 @@ } // Note, the ObjC Ivar Byte offset is just that, it doesn't - // account for the bit offset - // of a bitfield within its containing object. So regardless of - // where we get the byte + // account for the bit offset of a bitfield within its + // containing object. So regardless of where we get the byte // offset from, we still need to get the bit offset for // bitfields from the layout. @@ -6925,8 +6915,8 @@ } // Look for a child member (doesn't include base classes, but it does include -// their members) in the type hierarchy. Returns an index path into "clang_type" -// on how to reach the appropriate member. +// their members) in the type hierarchy. Returns an index path into +// "clang_type" on how to reach the appropriate member. // // class A // { @@ -6949,16 +6939,13 @@ // "m_b" in it: // // With omit_empty_base_classes == false we would get an integer array back -// with: -// { 1, 1 } -// The first index 1 is the child index for "class A" within class C -// The second index 1 is the child index for "m_b" within class A +// with: { 1, 1 } The first index 1 is the child index for "class A" within +// class C The second index 1 is the child index for "m_b" within class A // -// With omit_empty_base_classes == true we would get an integer array back with: -// { 0, 1 } -// The first index 0 is the child index for "class A" within class C (since -// class B doesn't have any members it doesn't count) -// The second index 1 is the child index for "m_b" within class A +// With omit_empty_base_classes == true we would get an integer array back +// with: { 0, 1 } The first index 0 is the child index for "class A" within +// class C (since class B doesn't have any members it doesn't count) The second +// index 1 is the child index for "m_b" within class A size_t ClangASTContext::GetIndexOfChildMemberWithName( lldb::opaque_compiler_type_t type, const char *name, @@ -7093,9 +7080,9 @@ } if (superclass_interface_decl) { - // The super class index is always zero for ObjC classes, - // so we push it onto the child indexes in case we find - // an ivar in our superclass... + // The super class index is always zero for ObjC classes, so we + // push it onto the child indexes in case we find an ivar in our + // superclass... child_indexes.push_back(0); CompilerType superclass_clang_type( @@ -7103,14 +7090,13 @@ superclass_interface_decl)); if (superclass_clang_type.GetIndexOfChildMemberWithName( name, omit_empty_base_classes, child_indexes)) { - // We did find an ivar in a superclass so just - // return the results! + // We did find an ivar in a superclass so just return the + // results! return child_indexes.size(); } - // We didn't find an ivar matching "name" in our - // superclass, pop the superclass zero index that - // we pushed on above. + // We didn't find an ivar matching "name" in our superclass, pop + // the superclass zero index that we pushed on above. child_indexes.pop_back(); } } @@ -7703,8 +7689,8 @@ clang::ICIS_NoInit); // HasInit if (!name) { - // Determine whether this field corresponds to an anonymous - // struct or union. + // Determine whether this field corresponds to an anonymous struct or + // union. if (const clang::TagType *TagT = field->getType()->getAs()) { if (clang::RecordDecl *Rec = @@ -7848,8 +7834,8 @@ } } - // Check the last field to see if it has an incomplete array type as its - // last member and if it does, the tell the record decl about it + // Check the last field to see if it has an incomplete array type as its last + // member and if it does, the tell the record decl about it if (last_field_pos != field_end_pos) { if (last_field_pos->getType()->isIncompleteArrayType()) record_decl->hasFlexibleArrayMember(); @@ -7983,11 +7969,10 @@ if (IsOperator(name, op_kind)) { if (op_kind != clang::NUM_OVERLOADED_OPERATORS) { - // Check the number of operator parameters. Sometimes we have - // seen bad DWARF that doesn't correctly describe operators and - // if we try to create a method and add it to the class, clang - // will assert and crash, so we need to make sure things are - // acceptable. + // Check the number of operator parameters. Sometimes we have seen bad + // DWARF that doesn't correctly describe operators and if we try to + // create a method and add it to the class, clang will assert and + // crash, so we need to make sure things are acceptable. const bool is_method = true; if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( is_method, op_kind, num_params)) @@ -8667,8 +8652,8 @@ clang::QualType qual_type(ClangUtil::GetQualType(type)); if (!qual_type.isNull()) { // Make sure we use the same methodology as - // ClangASTContext::StartTagDeclarationDefinition() - // as to how we start/end the definition. Previously we were calling + // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end + // the definition. Previously we were calling const clang::TagType *tag_type = qual_type->getAs(); if (tag_type) { clang::TagDecl *tag_decl = tag_type->getDecl(); @@ -8938,9 +8923,8 @@ for (field = record_decl->field_begin(), field_end = record_decl->field_end(); field != field_end; ++field, ++field_idx, ++child_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comma (for member 2 and beyond) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comma (for member 2 and beyond) for the struct/union/class member. if (child_idx == 0) s->PutChar('{'); else @@ -8951,8 +8935,8 @@ clang::QualType field_type = field->getType(); // Print the member type if requested - // Figure out the type byte size (field_type_info.first) and - // alignment (field_type_info.second) from the AST context. + // Figure out the type byte size (field_type_info.first) and alignment + // (field_type_info.second) from the AST context. clang::TypeInfo field_type_info = getASTContext()->getTypeInfo(field_type); assert(field_idx < record_layout.getFieldCount()); @@ -9023,8 +9007,8 @@ return; } } - // If we have gotten here we didn't get find the enumerator in the - // enum decl, so just print the integer. + // If we have gotten here we didn't get find the enumerator in the enum + // decl, so just print the integer. s->Printf("%" PRIi64, enum_value); } return; @@ -9062,9 +9046,8 @@ lldb::Format element_format = element_clang_type.GetFormat(); for (element_idx = 0; element_idx < element_count; ++element_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comman (for member 2 and beyong) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comman (for member 2 and beyong) for the struct/union/class member. if (element_idx == 0) s->PutChar('{'); else @@ -9260,8 +9243,8 @@ } break; case clang::Type::Enum: - // If our format is enum or default, show the enumeration value as - // its enumeration string value, else just display it as requested. + // If our format is enum or default, show the enumeration value as its + // enumeration string value, else just display it as requested. if ((format == eFormatEnum || format == eFormatDefault) && GetCompleteType(type)) { const clang::EnumType *enutype = @@ -9553,9 +9536,9 @@ if (objc_class_type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); - // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // We currently can't complete objective C types through the newly + // added ASTContext because it only supports TagDecl objects right + // now... if (class_interface_decl) printf("@class %s", class_interface_decl->getName().str().c_str()); } @@ -9813,15 +9796,12 @@ // Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents, // and return the number of levels it took to find it, or -// LLDB_INVALID_DECL_LEVEL -// if not found. If the decl was imported via a using declaration, its name -// and/or -// type, if set, will be used to check that the decl found in the scope is a -// match. +// LLDB_INVALID_DECL_LEVEL if not found. If the decl was imported via a using +// declaration, its name and/or type, if set, will be used to check that the +// decl found in the scope is a match. // // The optional name is required by languages (like C++) to handle using -// declarations -// like: +// declarations like: // // void poo(); // namespace ns { @@ -9850,14 +9830,10 @@ // // NOTE: Because file statics are at the TranslationUnit along with globals, a // function at file scope will return the same level as a function at global -// scope. -// Ideally we'd like to treat the file scope as an additional scope just below -// the -// global scope. More work needs to be done to recognise that, if the decl -// we're -// trying to look up is static, we should compare its source file with that of -// the -// current scope and return a lower number for it. +// scope. Ideally we'd like to treat the file scope as an additional scope just +// below the global scope. More work needs to be done to recognise that, if +// the decl we're trying to look up is static, we should compare its source +// file with that of the current scope and return a lower number for it. uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name, @@ -9886,10 +9862,8 @@ continue; // Currently DWARF has one shared translation unit for all Decls at top - // level, so this - // would erroneously find using statements anywhere. So don't look at - // the top-level - // translation unit. + // level, so this would erroneously find using statements anywhere. So + // don't look at the top-level translation unit. // TODO fix this and add a testcase that depends on it. if (llvm::isa(it->second)) Index: lldb/trunk/source/Symbol/ClangASTImporter.cpp =================================================================== --- lldb/trunk/source/Symbol/ClangASTImporter.cpp +++ lldb/trunk/source/Symbol/ClangASTImporter.cpp @@ -354,8 +354,7 @@ clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) return true; @@ -431,8 +430,7 @@ clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) return CompleteAndFetchChildren(qual_type); @@ -896,9 +894,9 @@ } } - // If we're dealing with an Objective-C class, ensure that the inheritance has - // been set up correctly. The ASTImporter may not do this correctly if the - // class was originally sourced from symbols. + // If we're dealing with an Objective-C class, ensure that the inheritance + // has been set up correctly. The ASTImporter may not do this correctly if + // the class was originally sourced from symbols. if (ObjCInterfaceDecl *to_objc_interface = dyn_cast(to)) { do { Index: lldb/trunk/source/Symbol/CompactUnwindInfo.cpp =================================================================== --- lldb/trunk/source/Symbol/CompactUnwindInfo.cpp +++ lldb/trunk/source/Symbol/CompactUnwindInfo.cpp @@ -262,8 +262,7 @@ if (m_unwindinfo_data_computed == false) { if (m_section_sp->IsEncrypted()) { // Can't get section contents of a protected/encrypted section until we - // have a live - // process and can read them out of memory. + // have a live process and can read them out of memory. if (process_sp.get() == nullptr) return; m_section_contents_if_encrypted.reset( @@ -329,11 +328,10 @@ return; } - // Parse the basic information from the indexes - // We wait to scan the second level page info until it's needed + // Parse the basic information from the indexes We wait to scan the second + // level page info until it's needed - // struct unwind_info_section_header_index_entry - // { + // struct unwind_info_section_header_index_entry { // uint32_t functionOffset; // uint32_t secondLevelPagesSectionOffset; // uint32_t lsdaIndexArraySectionOffset; @@ -388,8 +386,7 @@ uint32_t CompactUnwindInfo::GetLSDAForFunctionOffset(uint32_t lsda_offset, uint32_t lsda_count, uint32_t function_offset) { - // struct unwind_info_section_header_lsda_index_entry - // { + // struct unwind_info_section_header_lsda_index_entry { // uint32_t functionOffset; // uint32_t lsdaOffset; // }; @@ -419,8 +416,7 @@ uint32_t entry_page_offset, uint32_t entry_count, uint32_t function_offset, uint32_t *entry_func_start_offset, uint32_t *entry_func_end_offset) { // typedef uint32_t compact_unwind_encoding_t; - // struct unwind_info_regular_second_level_entry - // { + // struct unwind_info_regular_second_level_entry { // uint32_t functionOffset; // compact_unwind_encoding_t encoding; @@ -539,9 +535,9 @@ auto next_it = it + 1; if (next_it != m_indexes.end()) { - // initialize the function offset end range to be the start of the - // next index offset. If we find an entry which is at the end of - // the index table, this will establish the range end. + // initialize the function offset end range to be the start of the next + // index offset. If we find an entry which is at the end of the index + // table, this will establish the range end. unwind_info.valid_range_offset_end = next_it->function_offset; } @@ -554,15 +550,13 @@ &offset); // UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED if (kind == UNWIND_SECOND_LEVEL_REGULAR) { - // struct unwind_info_regular_second_level_page_header - // { + // struct unwind_info_regular_second_level_page_header { // uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR // uint16_t entryPageOffset; // uint16_t entryCount; // typedef uint32_t compact_unwind_encoding_t; - // struct unwind_info_regular_second_level_entry - // { + // struct unwind_info_regular_second_level_entry { // uint32_t functionOffset; // compact_unwind_encoding_t encoding; @@ -612,8 +606,7 @@ } return true; } else if (kind == UNWIND_SECOND_LEVEL_COMPRESSED) { - // struct unwind_info_compressed_second_level_page_header - // { + // struct unwind_info_compressed_second_level_page_header { // uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED // uint16_t entryPageOffset; // offset from this 2nd lvl page // idx to array of entries @@ -721,8 +714,8 @@ // enough }; -// Convert the compact_unwind_info.h register numbering scheme -// to eRegisterKindEHFrame (eh_frame) register numbering scheme. +// Convert the compact_unwind_info.h register numbering scheme to +// eRegisterKindEHFrame (eh_frame) register numbering scheme. uint32_t translate_to_eh_frame_regnum_x86_64(uint32_t unwind_regno) { switch (unwind_regno) { case UNWIND_X86_64_REG_RBX: @@ -802,9 +795,8 @@ case UNWIND_X86_64_MODE_STACK_IND: { // The clang in Xcode 6 is emitting incorrect compact unwind encodings for - // this - // style of unwind. It was fixed in llvm r217020. - // The clang in Xcode 7 has this fixed. + // this style of unwind. It was fixed in llvm r217020. The clang in Xcode + // 7 has this fixed. return false; } break; @@ -861,17 +853,17 @@ if (register_count > 0) { - // We need to include (up to) 6 registers in 10 bits. - // That would be 18 bits if we just used 3 bits per reg to indicate - // the order they're saved on the stack. + // We need to include (up to) 6 registers in 10 bits. That would be 18 + // bits if we just used 3 bits per reg to indicate the order they're + // saved on the stack. // // This is done with Lehmer code permutation, e.g. see - // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms + // http://stackoverflow.com/questions/1506078/fast-permutation-number- + // permutation-mapping-algorithms int permunreg[6] = {0, 0, 0, 0, 0, 0}; - // This decodes the variable-base number in the 10 bits - // and gives us the Lehmer code sequence which can then - // be decoded. + // This decodes the variable-base number in the 10 bits and gives us the + // Lehmer code sequence which can then be decoded. switch (register_count) { case 6: @@ -923,8 +915,8 @@ break; } - // Decode the Lehmer code for this permutation of - // the registers v. http://en.wikipedia.org/wiki/Lehmer_code + // Decode the Lehmer code for this permutation of the registers v. + // http://en.wikipedia.org/wiki/Lehmer_code int registers[6] = {UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, @@ -993,8 +985,8 @@ // enough }; -// Convert the compact_unwind_info.h register numbering scheme -// to eRegisterKindEHFrame (eh_frame) register numbering scheme. +// Convert the compact_unwind_info.h register numbering scheme to +// eRegisterKindEHFrame (eh_frame) register numbering scheme. uint32_t translate_to_eh_frame_regnum_i386(uint32_t unwind_regno) { switch (unwind_regno) { case UNWIND_X86_REG_EBX: @@ -1123,17 +1115,17 @@ if (register_count > 0) { - // We need to include (up to) 6 registers in 10 bits. - // That would be 18 bits if we just used 3 bits per reg to indicate - // the order they're saved on the stack. + // We need to include (up to) 6 registers in 10 bits. That would be 18 + // bits if we just used 3 bits per reg to indicate the order they're + // saved on the stack. // // This is done with Lehmer code permutation, e.g. see - // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms + // http://stackoverflow.com/questions/1506078/fast-permutation-number- + // permutation-mapping-algorithms int permunreg[6] = {0, 0, 0, 0, 0, 0}; - // This decodes the variable-base number in the 10 bits - // and gives us the Lehmer code sequence which can then - // be decoded. + // This decodes the variable-base number in the 10 bits and gives us the + // Lehmer code sequence which can then be decoded. switch (register_count) { case 6: @@ -1185,8 +1177,8 @@ break; } - // Decode the Lehmer code for this permutation of - // the registers v. http://en.wikipedia.org/wiki/Lehmer_code + // Decode the Lehmer code for this permutation of the registers v. + // http://en.wikipedia.org/wiki/Lehmer_code int registers[6] = {UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, @@ -1260,14 +1252,10 @@ pc = 32, // Compact unwind encodes d8-d15 but we don't have eh_frame / dwarf reg #'s - // for the 64-bit - // fp regs. Normally in DWARF it's context sensitive - so it knows it is - // fetching a - // 32- or 64-bit quantity from reg v8 to indicate s0 or d0 - but the unwinder - // is operating - // at a lower level and we'd try to fetch 128 bits if we were told that v8 - // were stored on - // the stack... + // for the 64-bit fp regs. Normally in DWARF it's context sensitive - so it + // knows it is fetching a 32- or 64-bit quantity from reg v8 to indicate s0 + // or d0 - but the unwinder is operating at a lower level and we'd try to + // fetch 128 bits if we were told that v8 were stored on the stack... v8 = 72, v9 = 73, v10 = 74, Index: lldb/trunk/source/Symbol/CompileUnit.cpp =================================================================== --- lldb/trunk/source/Symbol/CompileUnit.cpp +++ lldb/trunk/source/Symbol/CompileUnit.cpp @@ -67,10 +67,10 @@ } //---------------------------------------------------------------------- -// Dump the current contents of this object. No functions that cause on -// demand parsing of functions, globals, statics are called, so this -// is a good function to call to get an idea of the current contents of -// the CompileUnit object. +// Dump the current contents of this object. No functions that cause on demand +// parsing of functions, globals, statics are called, so this is a good +// function to call to get an idea of the current contents of the CompileUnit +// object. //---------------------------------------------------------------------- void CompileUnit::Dump(Stream *s, bool show_context) const { const char *language = Language::GetNameForLanguageType(m_language); @@ -118,28 +118,27 @@ } //---------------------------------------------------------------------- -// Find functions using the Mangled::Tokens token list. This -// function currently implements an interactive approach designed to find -// all instances of certain functions. It isn't designed to the -// quickest way to lookup functions as it will need to iterate through -// all functions and see if they match, though it does provide a powerful -// and context sensitive way to search for all functions with a certain -// name, all functions in a namespace, or all functions of a template -// type. See Mangled::Tokens::Parse() comments for more information. +// Find functions using the Mangled::Tokens token list. This function currently +// implements an interactive approach designed to find all instances of certain +// functions. It isn't designed to the quickest way to lookup functions as it +// will need to iterate through all functions and see if they match, though it +// does provide a powerful and context sensitive way to search for all +// functions with a certain name, all functions in a namespace, or all +// functions of a template type. See Mangled::Tokens::Parse() comments for more +// information. // -// The function prototype will need to change to return a list of -// results. It was originally used to help debug the Mangled class -// and the Mangled::Tokens::MatchesQuery() function and it currently -// will print out a list of matching results for the functions that -// are currently in this compile unit. +// The function prototype will need to change to return a list of results. It +// was originally used to help debug the Mangled class and the +// Mangled::Tokens::MatchesQuery() function and it currently will print out a +// list of matching results for the functions that are currently in this +// compile unit. // // A FindFunctions method should be called prior to this that takes -// a regular function name (const char * or ConstString as a parameter) -// before resorting to this slower but more complete function. The -// other FindFunctions method should be able to take advantage of any -// accelerator tables available in the debug information (which is -// parsed by the SymbolFile parser plug-ins and registered with each -// Module). +// a regular function name (const char * or ConstString as a parameter) before +// resorting to this slower but more complete function. The other FindFunctions +// method should be able to take advantage of any accelerator tables available +// in the debug information (which is parsed by the SymbolFile parser plug-ins +// and registered with each Module). //---------------------------------------------------------------------- // void // CompileUnit::FindFunctions(const Mangled::Tokens& tokens) @@ -283,8 +282,8 @@ bool exact, uint32_t resolve_scope, SymbolContextList &sc_list) { // First find all of the file indexes that match our "file_spec". If - // "file_spec" has an empty directory, then only compare the basenames - // when finding file indexes + // "file_spec" has an empty directory, then only compare the basenames when + // finding file indexes std::vector file_indexes; const bool full_match = (bool)file_spec.GetDirectory(); bool file_spec_matches_cu_file_spec = @@ -319,23 +318,23 @@ uint32_t line_idx; if (num_file_indexes == 1) { - // We only have a single support file that matches, so use - // the line table function that searches for a line entries - // that match a single support file index + // We only have a single support file that matches, so use the line + // table function that searches for a line entries that match a single + // support file index LineEntry line_entry; line_idx = line_table->FindLineEntryIndexByFileIndex( 0, file_indexes.front(), line, exact, &line_entry); - // If "exact == true", then "found_line" will be the same - // as "line". If "exact == false", the "found_line" will be the - // closest line entry with a line number greater than "line" and - // we will use this for our subsequent line exact matches below. + // If "exact == true", then "found_line" will be the same as "line". If + // "exact == false", the "found_line" will be the closest line entry + // with a line number greater than "line" and we will use this for our + // subsequent line exact matches below. found_line = line_entry.line; while (line_idx != UINT32_MAX) { - // If they only asked for the line entry, then we're done, we can just - // copy that over. - // But if they wanted more than just the line number, fill it in. + // If they only asked for the line entry, then we're done, we can + // just copy that over. But if they wanted more than just the line + // number, fill it in. if (resolve_scope == eSymbolContextLineEntry) { sc.line_entry = line_entry; } else { @@ -349,17 +348,17 @@ &line_entry); } } else { - // We found multiple support files that match "file_spec" so use - // the line table function that searches for a line entries - // that match a multiple support file indexes. + // We found multiple support files that match "file_spec" so use the + // line table function that searches for a line entries that match a + // multiple support file indexes. LineEntry line_entry; line_idx = line_table->FindLineEntryIndexByFileIndex( 0, file_indexes, line, exact, &line_entry); - // If "exact == true", then "found_line" will be the same - // as "line". If "exact == false", the "found_line" will be the - // closest line entry with a line number greater than "line" and - // we will use this for our subsequent line exact matches below. + // If "exact == true", then "found_line" will be the same as "line". If + // "exact == false", the "found_line" will be the closest line entry + // with a line number greater than "line" and we will use this for our + // subsequent line exact matches below. found_line = line_entry.line; while (line_idx != UINT32_MAX) { @@ -377,8 +376,8 @@ } } } else if (file_spec_matches_cu_file_spec && !check_inlines) { - // only append the context if we aren't looking for inline call sites - // by file and line and if the file spec matches that of the compile unit + // only append the context if we aren't looking for inline call sites by + // file and line and if the file spec matches that of the compile unit sc_list.Append(sc); } return sc_list.GetSize() - prev_size; Index: lldb/trunk/source/Symbol/CompilerType.cpp =================================================================== --- lldb/trunk/source/Symbol/CompilerType.cpp +++ lldb/trunk/source/Symbol/CompilerType.cpp @@ -638,8 +638,8 @@ } // Look for a child member (doesn't include base classes, but it does include -// their members) in the type hierarchy. Returns an index path into "clang_type" -// on how to reach the appropriate member. +// their members) in the type hierarchy. Returns an index path into +// "clang_type" on how to reach the appropriate member. // // class A // { @@ -662,16 +662,13 @@ // "m_b" in it: // // With omit_empty_base_classes == false we would get an integer array back -// with: -// { 1, 1 } -// The first index 1 is the child index for "class A" within class C -// The second index 1 is the child index for "m_b" within class A +// with: { 1, 1 } The first index 1 is the child index for "class A" within +// class C The second index 1 is the child index for "m_b" within class A // -// With omit_empty_base_classes == true we would get an integer array back with: -// { 0, 1 } -// The first index 0 is the child index for "class A" within class C (since -// class B doesn't have any members it doesn't count) -// The second index 1 is the child index for "m_b" within class A +// With omit_empty_base_classes == true we would get an integer array back +// with: { 0, 1 } The first index 0 is the child index for "class A" within +// class C (since class B doesn't have any members it doesn't count) The second +// index 1 is the child index for "m_b" within class A size_t CompilerType::GetIndexOfChildMemberWithName( const char *name, bool omit_empty_base_classes, @@ -987,8 +984,8 @@ if (!IsValid()) return false; - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context (which + // Module it came from) if (address_type == eAddressTypeFile) return false; @@ -1029,8 +1026,8 @@ if (!IsValid()) return false; - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context (which + // Module it came from) if (address_type == eAddressTypeFile) return false; Index: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp =================================================================== --- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp +++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp @@ -27,8 +27,8 @@ //---------------------------------------------------------------------- // GetDwarfEHPtr // -// Used for calls when the value type is specified by a DWARF EH Frame -// pointer encoding. +// Used for calls when the value type is specified by a DWARF EH Frame pointer +// encoding. //---------------------------------------------------------------------- static uint64_t GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr, @@ -83,8 +83,8 @@ break; case DW_EH_PE_aligned: { - // SetPointerSize should be called prior to extracting these so the - // pointer size is cached + // SetPointerSize should be called prior to extracting these so the pointer + // size is cached assert(addr_size != 0); if (addr_size) { // Align to a address size boundary first @@ -154,8 +154,8 @@ bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) { FDEEntryMap::Entry fde_entry; - // Make sure that the Address we're searching for is the same object file - // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index. + // Make sure that the Address we're searching for is the same object file as + // this DWARFCallFrameInfo, we only store File offsets in m_fde_index. ModuleSP module_sp = addr.GetModule(); if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile) @@ -168,8 +168,8 @@ bool DWARFCallFrameInfo::GetAddressRange(Address addr, AddressRange &range) { - // Make sure that the Address we're searching for is the same object file - // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index. + // Make sure that the Address we're searching for is the same object file as + // this DWARFCallFrameInfo, we only store File offsets in m_fde_index. ModuleSP module_sp = addr.GetModule(); if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile) @@ -291,8 +291,8 @@ return nullptr; } - // m_cfi_data uses address size from target architecture of the process - // may ignore these fields? + // m_cfi_data uses address size from target architecture of the process may + // ignore these fields? if (m_type == DWARF && cie_sp->version >= CFI_VERSION4) { cie_sp->address_size = m_cfi_data.GetU8(&offset); cie_sp->segment_size = m_cfi_data.GetU8(&offset); @@ -307,15 +307,15 @@ : m_cfi_data.GetU8(&offset); if (cie_sp->augmentation[0]) { - // Get the length of the eh_frame augmentation data - // which starts with a ULEB128 length in bytes + // Get the length of the eh_frame augmentation data which starts with a + // ULEB128 length in bytes const size_t aug_data_len = (size_t)m_cfi_data.GetULEB128(&offset); const size_t aug_data_end = offset + aug_data_len; const size_t aug_str_len = strlen(cie_sp->augmentation); // A 'z' may be present as the first character of the string. - // If present, the Augmentation Data field shall be present. - // The contents of the Augmentation Data shall be interpreted - // according to other characters in the Augmentation String. + // If present, the Augmentation Data field shall be present. The contents + // of the Augmentation Data shall be interpreted according to other + // characters in the Augmentation String. if (cie_sp->augmentation[0] == 'z') { // Extract the Augmentation Data size_t aug_str_idx = 0; @@ -323,31 +323,27 @@ char aug = cie_sp->augmentation[aug_str_idx]; switch (aug) { case 'L': - // Indicates the presence of one argument in the - // Augmentation Data of the CIE, and a corresponding - // argument in the Augmentation Data of the FDE. The - // argument in the Augmentation Data of the CIE is - // 1-byte and represents the pointer encoding used - // for the argument in the Augmentation Data of the - // FDE, which is the address of a language-specific - // data area (LSDA). The size of the LSDA pointer is - // specified by the pointer encoding used. + // Indicates the presence of one argument in the Augmentation Data + // of the CIE, and a corresponding argument in the Augmentation + // Data of the FDE. The argument in the Augmentation Data of the + // CIE is 1-byte and represents the pointer encoding used for the + // argument in the Augmentation Data of the FDE, which is the + // address of a language-specific data area (LSDA). The size of the + // LSDA pointer is specified by the pointer encoding used. cie_sp->lsda_addr_encoding = m_cfi_data.GetU8(&offset); break; case 'P': - // Indicates the presence of two arguments in the - // Augmentation Data of the CIE. The first argument - // is 1-byte and represents the pointer encoding - // used for the second argument, which is the - // address of a personality routine handler. The - // size of the personality routine pointer is - // specified by the pointer encoding used. + // Indicates the presence of two arguments in the Augmentation Data + // of the CIE. The first argument is 1-byte and represents the + // pointer encoding used for the second argument, which is the + // address of a personality routine handler. The size of the + // personality routine pointer is specified by the pointer encoding + // used. // - // The address of the personality function will - // be stored at this location. Pre-execution, it - // will be all zero's so don't read it until we're - // trying to do an unwind & the reloc has been + // The address of the personality function will be stored at this + // location. Pre-execution, it will be all zero's so don't read it + // until we're trying to do an unwind & the reloc has been // resolved. { uint8_t arg_ptr_encoding = m_cfi_data.GetU8(&offset); @@ -360,22 +356,21 @@ case 'R': // A 'R' may be present at any position after the - // first character of the string. The Augmentation - // Data shall include a 1 byte argument that - // represents the pointer encoding for the address - // pointers used in the FDE. - // Example: 0x1B == DW_EH_PE_pcrel | DW_EH_PE_sdata4 + // first character of the string. The Augmentation Data shall + // include a 1 byte argument that represents the pointer encoding + // for the address pointers used in the FDE. Example: 0x1B == + // DW_EH_PE_pcrel | DW_EH_PE_sdata4 cie_sp->ptr_encoding = m_cfi_data.GetU8(&offset); break; } } } else if (strcmp(cie_sp->augmentation, "eh") == 0) { - // If the Augmentation string has the value "eh", then - // the EH Data field shall be present + // If the Augmentation string has the value "eh", then the EH Data + // field shall be present } - // Set the offset to be the end of the augmentation data just in case - // we didn't understand any of the data. + // Set the offset to be the end of the augmentation data just in case we + // didn't understand any of the data. offset = (uint32_t)aug_data_end; } @@ -408,10 +403,8 @@ } } // Scan through the eh_frame or debug_frame section looking for FDEs and noting -// the start/end addresses -// of the functions and a pointer back to the function's FDE for later -// expansion. -// Internalize CIEs as we come across them. +// the start/end addresses of the functions and a pointer back to the +// function's FDE for later expansion. Internalize CIEs as we come across them. void DWARFCallFrameInfo::GetFDEIndex() { if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted()) @@ -469,8 +462,8 @@ } // An FDE entry contains CIE_pointer in debug_frame in same place as cie_id - // in eh_frame. CIE_pointer is an offset into the .debug_frame section. - // So, variable cie_offset should be equal to cie_id for debug_frame. + // in eh_frame. CIE_pointer is an offset into the .debug_frame section. So, + // variable cie_offset should be equal to cie_id for debug_frame. // FDE entries with cie_id == 0 shouldn't be ignored for it. if ((cie_id == 0 && m_type == EH) || cie_id == UINT32_MAX || len == 0) { auto cie_sp = ParseCIE(current_entry); @@ -556,9 +549,8 @@ // FDE entries with zeroth cie_offset may occur for debug_frame. assert(!(m_type == EH && 0 == cie_offset) && cie_offset != UINT32_MAX); - // Translate the CIE_id from the eh_frame format, which - // is relative to the FDE offset, into a __eh_frame section - // offset + // Translate the CIE_id from the eh_frame format, which is relative to the + // FDE offset, into a __eh_frame section offset if (m_type == EH) { unwind_plan.SetSourceName("eh_frame CFI"); cie_offset = current_entry + (is_64bit ? 12 : 4) - cie_offset; @@ -652,10 +644,10 @@ case DW_CFA_advance_loc: // (Row Creation Instruction) { // 0x40 - high 2 bits are 0x1, lower 6 bits are delta // takes a single argument that represents a constant delta. The - // required action is to create a new table row with a location - // value that is computed by taking the current entry's location - // value and adding (delta * code_align). All other - // values in the new row are initially identical to the current row. + // required action is to create a new table row with a location value + // that is computed by taking the current entry's location value and + // adding (delta * code_align). All other values in the new row are + // initially identical to the current row. unwind_plan.AppendRow(row); UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *row.get(); @@ -670,11 +662,10 @@ // required action is to change the rule for the indicated register // to the rule assigned it by the initial_instructions in the CIE. uint32_t reg_num = extended_opcode; - // We only keep enough register locations around to - // unwind what is in our thread, and these are organized - // by the register index in that state, so we need to convert our - // eh_frame register number from the EH frame info, to a register - // index + // We only keep enough register locations around to unwind what is in + // our thread, and these are organized by the register index in that + // state, so we need to convert our eh_frame register number from the + // EH frame info, to a register index if (unwind_plan.IsValidRowIndex(0) && unwind_plan.GetRowAtIndex(0)->GetRegisterInfo(reg_num, @@ -756,8 +747,8 @@ case DW_CFA_remember_state: // 0xA { // These instructions define a stack of information. Encountering the - // DW_CFA_remember_state instruction means to save the rules for every - // register on the current row on the stack. Encountering the + // DW_CFA_remember_state instruction means to save the rules for + // every register on the current row on the stack. Encountering the // DW_CFA_restore_state instruction means to pop the set of rules off // the stack and place them in the current row. (This operation is // useful for compilers that move epilogue code into the body of a @@ -772,8 +763,8 @@ case DW_CFA_restore_state: // 0xB { // These instructions define a stack of information. Encountering the - // DW_CFA_remember_state instruction means to save the rules for every - // register on the current row on the stack. Encountering the + // DW_CFA_remember_state instruction means to save the rules for + // every register on the current row on the stack. Encountering the // DW_CFA_restore_state instruction means to pop the set of rules off // the stack and place them in the current row. (This operation is // useful for compilers that move epilogue code into the body of a @@ -798,10 +789,9 @@ case DW_CFA_GNU_args_size: // 0x2e { // The DW_CFA_GNU_args_size instruction takes an unsigned LEB128 - // operand - // representing an argument size. This instruction specifies the total - // of - // the size of the arguments which have been pushed onto the stack. + // operand representing an argument size. This instruction specifies + // the total of the size of the arguments which have been pushed onto + // the stack. // TODO: Figure out how we should handle this. m_cfi_data.GetULEB128(&offset); @@ -834,9 +824,9 @@ // register // takes two arguments: an unsigned LEB128 constant representing a // factored offset and a register number. The required action is to - // change the rule for the register indicated by the register number - // to be an offset(N) rule with a value of - // (N = factored offset * data_align). + // change the rule for the register indicated by the register number to + // be an offset(N) rule with a value of (N = factored offset * + // data_align). uint8_t reg_num = extended_opcode; int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align; reg_location.SetAtCFAPlusOffset(op_offset); @@ -851,8 +841,8 @@ case DW_CFA_offset_extended: // 0x5 { - // takes two unsigned LEB128 arguments representing a register number - // and a factored offset. This instruction is identical to DW_CFA_offset + // takes two unsigned LEB128 arguments representing a register number and + // a factored offset. This instruction is identical to DW_CFA_offset // except for the encoding and size of the register argument. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align; @@ -888,9 +878,9 @@ case DW_CFA_register: // 0x9 { - // takes two unsigned LEB128 arguments representing register numbers. - // The required action is to set the rule for the first register to be - // the second register. + // takes two unsigned LEB128 arguments representing register numbers. The + // required action is to set the rule for the first register to be the + // second register. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); uint32_t other_reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); UnwindPlan::Row::RegisterLocation reg_location; @@ -901,10 +891,9 @@ case DW_CFA_def_cfa: // 0xC (CFA Definition Instruction) { - // Takes two unsigned LEB128 operands representing a register - // number and a (non-factored) offset. The required action - // is to define the current CFA rule to use the provided - // register and offset. + // Takes two unsigned LEB128 operands representing a register number and + // a (non-factored) offset. The required action is to define the current + // CFA rule to use the provided register and offset. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset); @@ -914,8 +903,8 @@ case DW_CFA_def_cfa_register: // 0xD (CFA Definition Instruction) { // takes a single unsigned LEB128 argument representing a register - // number. The required action is to define the current CFA rule to - // use the provided register (but to keep the old offset). + // number. The required action is to define the current CFA rule to use + // the provided register (but to keep the old offset). uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, row.GetCFAValue().GetOffset()); @@ -924,10 +913,9 @@ case DW_CFA_def_cfa_offset: // 0xE (CFA Definition Instruction) { - // Takes a single unsigned LEB128 operand representing a - // (non-factored) offset. The required action is to define - // the current CFA rule to use the provided offset (but - // to keep the old register). + // Takes a single unsigned LEB128 operand representing a (non-factored) + // offset. The required action is to define the current CFA rule to use + // the provided offset (but to keep the old register). int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset( row.GetCFAValue().GetRegisterNumber(), op_offset); @@ -945,14 +933,13 @@ case DW_CFA_expression: // 0x10 { - // Takes two operands: an unsigned LEB128 value representing - // a register number, and a DW_FORM_block value representing a DWARF - // expression. The required action is to change the rule for the - // register indicated by the register number to be an expression(E) - // rule where E is the DWARF expression. That is, the DWARF - // expression computes the address. The value of the CFA is - // pushed on the DWARF evaluation stack prior to execution of - // the DWARF expression. + // Takes two operands: an unsigned LEB128 value representing a register + // number, and a DW_FORM_block value representing a DWARF expression. The + // required action is to change the rule for the register indicated by + // the register number to be an expression(E) rule where E is the DWARF + // expression. That is, the DWARF expression computes the address. The + // value of the CFA is pushed on the DWARF evaluation stack prior to + // execution of the DWARF expression. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); uint32_t block_len = (uint32_t)m_cfi_data.GetULEB128(&offset); const uint8_t *block_data = @@ -965,10 +952,10 @@ case DW_CFA_offset_extended_sf: // 0x11 { - // takes two operands: an unsigned LEB128 value representing a - // register number and a signed LEB128 factored offset. This - // instruction is identical to DW_CFA_offset_extended except - // that the second operand is signed and factored. + // takes two operands: an unsigned LEB128 value representing a register + // number and a signed LEB128 factored offset. This instruction is + // identical to DW_CFA_offset_extended except that the second operand is + // signed and factored. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; UnwindPlan::Row::RegisterLocation reg_location; @@ -979,10 +966,10 @@ case DW_CFA_def_cfa_sf: // 0x12 (CFA Definition Instruction) { - // Takes two operands: an unsigned LEB128 value representing - // a register number and a signed LEB128 factored offset. - // This instruction is identical to DW_CFA_def_cfa except - // that the second operand is signed and factored. + // Takes two operands: an unsigned LEB128 value representing a register + // number and a signed LEB128 factored offset. This instruction is + // identical to DW_CFA_def_cfa except that the second operand is signed + // and factored. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset); @@ -991,9 +978,9 @@ case DW_CFA_def_cfa_offset_sf: // 0x13 (CFA Definition Instruction) { - // takes a signed LEB128 operand representing a factored - // offset. This instruction is identical to DW_CFA_def_cfa_offset - // except that the operand is signed and factored. + // takes a signed LEB128 operand representing a factored offset. This + // instruction is identical to DW_CFA_def_cfa_offset except that the + // operand is signed and factored. int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; uint32_t cfa_regnum = row.GetCFAValue().GetRegisterNumber(); row.GetCFAValue().SetIsRegisterPlusOffset(cfa_regnum, op_offset); @@ -1003,9 +990,9 @@ case DW_CFA_val_expression: // 0x16 { // takes two operands: an unsigned LEB128 value representing a register - // number, and a DW_FORM_block value representing a DWARF expression. - // The required action is to change the rule for the register indicated - // by the register number to be a val_expression(E) rule where E is the + // number, and a DW_FORM_block value representing a DWARF expression. The + // required action is to change the rule for the register indicated by + // the register number to be a val_expression(E) rule where E is the // DWARF expression. That is, the DWARF expression computes the value of // the given register. The value of the CFA is pushed on the DWARF // evaluation stack prior to execution of the DWARF expression. Index: lldb/trunk/source/Symbol/FuncUnwinders.cpp =================================================================== --- lldb/trunk/source/Symbol/FuncUnwinders.cpp +++ lldb/trunk/source/Symbol/FuncUnwinders.cpp @@ -174,10 +174,9 @@ m_tried_unwind_plan_eh_frame_augmented) return m_unwind_plan_eh_frame_augmented_sp; - // Only supported on x86 architectures where we get eh_frame from the compiler - // that describes - // the prologue instructions perfectly, and sometimes the epilogue - // instructions too. + // Only supported on x86 architectures where we get eh_frame from the + // compiler that describes the prologue instructions perfectly, and sometimes + // the epilogue instructions too. if (target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_32_i386 && target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64 && target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64h) { @@ -194,8 +193,7 @@ m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan)); // Augment the eh_frame instructions with epilogue descriptions if necessary - // so the - // UnwindPlan can be used at any instruction in the function. + // so the UnwindPlan can be used at any instruction in the function. UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target)); if (assembly_profiler_sp) { @@ -238,7 +236,8 @@ new UnwindPlan(*debug_frame_plan)); // Augment the debug_frame instructions with epilogue descriptions if - // necessary so the UnwindPlan can be used at any instruction in the function. + // necessary so the UnwindPlan can be used at any instruction in the + // function. UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target)); if (assembly_profiler_sp) { @@ -275,8 +274,7 @@ // This method compares the pc unwind rule in the first row of two UnwindPlans. // If they have the same way of getting the pc value (e.g. "CFA - 8" + "CFA is -// sp"), -// then it will return LazyBoolTrue. +// sp"), then it will return LazyBoolTrue. LazyBool FuncUnwinders::CompareUnwindPlansForIdenticalInitialPCLocation( Thread &thread, const UnwindPlanSP &a, const UnwindPlanSP &b) { LazyBool plans_are_identical = eLazyBoolCalculate; @@ -320,22 +318,22 @@ UnwindPlanSP assembly_sp = GetAssemblyUnwindPlan(target, thread, current_offset); - // This point of this code is to detect when a function is using a - // non-standard ABI, and the eh_frame correctly describes that alternate ABI. + // This point of this code is to detect when a function is using a non- + // standard ABI, and the eh_frame correctly describes that alternate ABI. // This is addressing a specific situation on x86_64 linux systems where one // function in a library pushes a value on the stack and jumps to another - // function. So using an assembly instruction based unwind will not work when - // you're in the second function - the stack has been modified in a non-ABI - // way. But we have eh_frame that correctly describes how to unwind from this - // location. So we're looking to see if the initial pc register save location - // from the eh_frame is different from the assembly unwind, the arch default - // unwind, and the arch default at initial function entry. + // function. So using an assembly instruction based unwind will not work + // when you're in the second function - the stack has been modified in a non- + // ABI way. But we have eh_frame that correctly describes how to unwind from + // this location. So we're looking to see if the initial pc register save + // location from the eh_frame is different from the assembly unwind, the arch + // default unwind, and the arch default at initial function entry. // // We may have eh_frame that describes the entire function -- or we may have // eh_frame that only describes the unwind after the prologue has executed -- // so we need to check both the arch default (once the prologue has executed) - // and the arch default at initial function entry. And we may be running on a - // target where we have only some of the assembly/arch default unwind plans + // and the arch default at initial function entry. And we may be running on + // a target where we have only some of the assembly/arch default unwind plans // available. if (CompareUnwindPlansForIdenticalInitialPCLocation( Index: lldb/trunk/source/Symbol/Function.cpp =================================================================== --- lldb/trunk/source/Symbol/Function.cpp +++ lldb/trunk/source/Symbol/Function.cpp @@ -24,9 +24,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// Basic function information is contained in the FunctionInfo class. -// It is designed to contain the name, linkage name, and declaration -// location. +// Basic function information is contained in the FunctionInfo class. It is +// designed to contain the name, linkage name, and declaration location. //---------------------------------------------------------------------- FunctionInfo::FunctionInfo(const char *name, const Declaration *decl_ptr) : m_name(name), m_declaration(decl_ptr) {} @@ -188,8 +187,7 @@ source_file.Clear(); // The -1 is kind of cheesy, but I want to get the last line entry for the - // given function, not the - // first entry of the next. + // given function, not the first entry of the next. Address scratch_addr(GetAddressRange().GetBaseAddress()); scratch_addr.SetOffset(scratch_addr.GetOffset() + GetAddressRange().GetByteSize() - 1); @@ -331,9 +329,8 @@ bool Function::GetIsOptimized() { bool result = false; - // Currently optimization is only indicted by the - // vendor extension DW_AT_APPLE_optimized which - // is set on a compile unit level. + // Currently optimization is only indicted by the vendor extension + // DW_AT_APPLE_optimized which is set on a compile unit level. if (m_comp_unit) { result = m_comp_unit->GetIsOptimized(); } @@ -441,11 +438,11 @@ } } - // If we didn't find the end of the prologue in the line tables, - // then just use the end address of the first line table entry + // If we didn't find the end of the prologue in the line tables, then + // just use the end address of the first line table entry if (prologue_end_file_addr == LLDB_INVALID_ADDRESS) { - // Check the first few instructions and look for one that has - // a line number that's different than the first entry. + // Check the first few instructions and look for one that has a line + // number that's different than the first entry. uint32_t last_line_entry_idx = first_line_entry_idx + 6; for (uint32_t idx = first_line_entry_idx + 1; idx < last_line_entry_idx; ++idx) { @@ -498,8 +495,8 @@ } } - // Verify that this prologue end file address in the function's - // address range just to be sure + // Verify that this prologue end file address in the function's address + // range just to be sure if (func_start_file_addr < prologue_end_file_addr && prologue_end_file_addr < func_end_file_addr) { m_prologue_byte_size = prologue_end_file_addr - func_start_file_addr; Index: lldb/trunk/source/Symbol/GoASTContext.cpp =================================================================== --- lldb/trunk/source/Symbol/GoASTContext.cpp +++ lldb/trunk/source/Symbol/GoASTContext.cpp @@ -667,8 +667,7 @@ } // Returns -1 if this isn't a function of if the function doesn't have a -// prototype -// Returns a value >= 0 if there is a prototype. +// prototype Returns a value >= 0 if there is a prototype. int GoASTContext::GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) { return GetNumberOfFunctionArguments(type); } @@ -1008,8 +1007,8 @@ return CompilerType(); } -// Lookup a child given a name. This function will match base class names -// and member member names in "clang_type" only, not descendants. +// Lookup a child given a name. This function will match base class names and +// member member names in "clang_type" only, not descendants. uint32_t GoASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, @@ -1048,8 +1047,8 @@ return 1; } -// Converts "s" to a floating point value and place resulting floating -// point bytes in the "dst" buffer. +// Converts "s" to a floating point value and place resulting floating point +// bytes in the "dst" buffer. size_t GoASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, @@ -1080,9 +1079,8 @@ uint32_t field_idx = 0; for (auto *field = st->GetField(field_idx); field != nullptr; field_idx++) { - // Print the starting squiggly bracket (if this is the - // first member) or comma (for member 2 and beyond) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comma (for member 2 and beyond) for the struct/union/class member. if (field_idx == 0) s->PutChar('{'); else @@ -1137,9 +1135,8 @@ uint64_t element_idx; for (element_idx = 0; element_idx < a->GetLength(); ++element_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comman (for member 2 and beyong) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comman (for member 2 and beyong) for the struct/union/class member. if (element_idx == 0) s->PutChar('{'); else Index: lldb/trunk/source/Symbol/LineEntry.cpp =================================================================== --- lldb/trunk/source/Symbol/LineEntry.cpp +++ lldb/trunk/source/Symbol/LineEntry.cpp @@ -170,9 +170,9 @@ if (a_byte_size > b_byte_size) return +1; - // Check for an end sequence entry mismatch after we have determined - // that the address values are equal. If one of the items is an end - // sequence, we don't care about the line, file, or column info. + // Check for an end sequence entry mismatch after we have determined that the + // address values are equal. If one of the items is an end sequence, we don't + // care about the line, file, or column info. if (a.is_terminal_entry > b.is_terminal_entry) return -1; if (a.is_terminal_entry < b.is_terminal_entry) @@ -192,8 +192,8 @@ } AddressRange LineEntry::GetSameLineContiguousAddressRange() const { - // Add each LineEntry's range to complete_line_range until we find - // a different file / line number. + // Add each LineEntry's range to complete_line_range until we find a + // different file / line number. AddressRange complete_line_range = range; while (true) { @@ -206,9 +206,8 @@ if (next_line_sc.line_entry.IsValid() && next_line_sc.line_entry.range.GetByteSize() > 0 && original_file == next_line_sc.line_entry.original_file) { - // Include any line 0 entries - they indicate that this is - // compiler-generated code - // that does not correspond to user source code. + // Include any line 0 entries - they indicate that this is compiler- + // generated code that does not correspond to user source code. if (next_line_sc.line_entry.line == 0) { complete_line_range.SetByteSize( complete_line_range.GetByteSize() + @@ -217,10 +216,9 @@ } if (line == next_line_sc.line_entry.line) { - // next_line_sc is the same file & line as this LineEntry, so extend our - // AddressRange by its size and continue to see if there are more - // LineEntries - // that we can combine. + // next_line_sc is the same file & line as this LineEntry, so extend + // our AddressRange by its size and continue to see if there are more + // LineEntries that we can combine. complete_line_range.SetByteSize( complete_line_range.GetByteSize() + next_line_sc.line_entry.range.GetByteSize()); Index: lldb/trunk/source/Symbol/LineTable.cpp =================================================================== --- lldb/trunk/source/Symbol/LineTable.cpp +++ lldb/trunk/source/Symbol/LineTable.cpp @@ -73,30 +73,24 @@ is_terminal_entry); entry_collection &entries = seq->m_entries; // Replace the last entry if the address is the same, otherwise append it. If - // we have multiple - // line entries at the same address, this indicates illegal DWARF so this - // "fixes" the line table - // to be correct. If not fixed this can cause a line entry's address that when - // resolved back to - // a symbol context, could resolve to a different line entry. We really want a + // we have multiple line entries at the same address, this indicates illegal + // DWARF so this "fixes" the line table to be correct. If not fixed this can + // cause a line entry's address that when resolved back to a symbol context, + // could resolve to a different line entry. We really want a // 1 to 1 mapping - // here to avoid these kinds of inconsistencies. We will need tor revisit this - // if the DWARF line - // tables are updated to allow multiple entries at the same address legally. + // here to avoid these kinds of inconsistencies. We will need tor revisit + // this if the DWARF line tables are updated to allow multiple entries at the + // same address legally. if (!entries.empty() && entries.back().file_addr == file_addr) { // GCC don't use the is_prologue_end flag to mark the first instruction // after the prologue. // Instead of it it is issuing a line table entry for the first instruction - // of the prologue - // and one for the first instruction after the prologue. If the size of the - // prologue is 0 - // instruction then the 2 line entry will have the same file address. - // Removing it will remove - // our ability to properly detect the location of the end of prologe so we - // set the prologue_end - // flag to preserve this information (setting the prologue_end flag for an - // entry what is after - // the prologue end don't have any effect) + // of the prologue and one for the first instruction after the prologue. If + // the size of the prologue is 0 instruction then the 2 line entry will + // have the same file address. Removing it will remove our ability to + // properly detect the location of the end of prologe so we set the + // prologue_end flag to preserve this information (setting the prologue_end + // flag for an entry what is after the prologue end don't have any effect) entry.is_prologue_end = entry.file_idx == entries.back().file_idx; entries.back() = entry; } else @@ -200,14 +194,13 @@ if (pos->file_addr != search_entry.file_addr) --pos; else if (pos->file_addr == search_entry.file_addr) { - // If this is a termination entry, it shouldn't match since - // entries with the "is_terminal_entry" member set to true - // are termination entries that define the range for the - // previous entry. + // If this is a termination entry, it shouldn't match since entries + // with the "is_terminal_entry" member set to true are termination + // entries that define the range for the previous entry. if (pos->is_terminal_entry) { - // The matching entry is a terminal entry, so we skip - // ahead to the next entry to see if there is another - // entry following this one whose section/offset matches. + // The matching entry is a terminal entry, so we skip ahead to + // the next entry to see if there is another entry following this + // one whose section/offset matches. ++pos; if (pos != end_pos) { if (pos->file_addr != search_entry.file_addr) @@ -216,9 +209,8 @@ } if (pos != end_pos) { - // While in the same section/offset backup to find the first - // line entry that matches the address in case there are - // multiple + // While in the same section/offset backup to find the first line + // entry that matches the address in case there are multiple while (pos != begin_pos) { entry_collection::const_iterator prev_pos = pos - 1; if (prev_pos->file_addr == search_entry.file_addr && @@ -232,16 +224,15 @@ } else { - // There might be code in the containing objfile before the first line - // table entry. Make sure that does not get considered part of the first - // line table entry. + // There might be code in the containing objfile before the first + // line table entry. Make sure that does not get considered part of + // the first line table entry. if (pos->file_addr > so_addr.GetFileAddress()) return false; } // Make sure we have a valid match and that the match isn't a - // terminating - // entry for a previous line... + // terminating entry for a previous line... if (pos != end_pos && pos->is_terminal_entry == false) { uint32_t match_idx = std::distance(begin_pos, pos); success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry); @@ -304,8 +295,7 @@ continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -349,8 +339,7 @@ continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -389,8 +378,8 @@ SymbolContext sc(m_comp_unit); for (size_t idx = 0; idx < count; ++idx) { - // Skip line table rows that terminate the previous row (is_terminal_entry - // is non-zero) + // Skip line table rows that terminate the previous row + // (is_terminal_entry is non-zero) if (m_entries[idx].is_terminal_entry) continue; @@ -497,10 +486,9 @@ terminate_previous_entry = prev_entry_was_linked; } } else if (prev_entry_was_linked) { - // This entry doesn't have a remapping and it needs to be removed. - // Watch out in case we need to terminate a previous entry needs to - // be terminated now that one line entry in a sequence is not longer - // valid. + // This entry doesn't have a remapping and it needs to be removed. Watch + // out in case we need to terminate a previous entry needs to be + // terminated now that one line entry in a sequence is not longer valid. if (!sequence.m_entries.empty() && !sequence.m_entries.back().is_terminal_entry) { terminate_previous_entry = true; Index: lldb/trunk/source/Symbol/ObjectFile.cpp =================================================================== --- lldb/trunk/source/Symbol/ObjectFile.cpp +++ lldb/trunk/source/Symbol/ObjectFile.cpp @@ -50,10 +50,9 @@ const bool file_exists = file->Exists(); if (!data_sp) { - // We have an object name which most likely means we have - // a .o file in a static archive (.a file). Try and see if - // we have a cached archive first without reading any data - // first + // We have an object name which most likely means we have a .o file in + // a static archive (.a file). Try and see if we have a cached archive + // first without reading any data first if (file_exists && module_sp->GetObjectName()) { for (uint32_t idx = 0; (create_object_container_callback = @@ -72,10 +71,10 @@ return object_file_sp; } } - // Ok, we didn't find any containers that have a named object, now - // lets read the first 512 bytes from the file so the object file - // and object container plug-ins can use these bytes to see if they - // can parse this file. + // Ok, we didn't find any containers that have a named object, now lets + // read the first 512 bytes from the file so the object file and object + // container plug-ins can use these bytes to see if they can parse this + // file. if (file_size > 0) { data_sp = DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset); @@ -98,11 +97,12 @@ file = &archive_file; module_sp->SetFileSpecAndObjectName(archive_file, archive_object); // Check if this is a object container by iterating through all - // object - // container plugin instances and then trying to get an object file - // from the container plugins since we had a name. Also, don't read + // object container plugin instances and then trying to get an + // object file from the container plugins since we had a name. + // Also, don't read // ANY data in case there is data cached in the container plug-ins - // (like BSD archives caching the contained objects within an file). + // (like BSD archives caching the contained objects within an + // file). for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex( @@ -119,8 +119,8 @@ if (object_file_sp.get()) return object_file_sp; } - // We failed to find any cached object files in the container - // plug-ins, so lets read the first 512 bytes and try again below... + // We failed to find any cached object files in the container plug- + // ins, so lets read the first 512 bytes and try again below... data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(), 512, file_offset); } @@ -128,8 +128,8 @@ } if (data_sp && data_sp->GetByteSize() > 0) { - // Check if this is a normal object file by iterating through - // all object file plugin instances. + // Check if this is a normal object file by iterating through all + // object file plugin instances. ObjectFileCreateInstance create_object_file_callback; for (uint32_t idx = 0; (create_object_file_callback = @@ -142,9 +142,9 @@ return object_file_sp; } - // Check if this is a object container by iterating through - // all object container plugin instances and then trying to get - // an object file from the container. + // Check if this is a object container by iterating through all object + // container plugin instances and then trying to get an object file + // from the container. for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex( @@ -163,8 +163,8 @@ } } } - // We didn't find it, so clear our shared pointer in case it - // contains anything and return an empty shared pointer + // 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(); return object_file_sp; } @@ -185,8 +185,8 @@ static_cast(process_sp.get()), header_addr); uint32_t idx; - // Check if this is a normal object file by iterating through - // all object file plugin instances. + // Check if this is a normal object file by iterating through all object + // file plugin instances. ObjectFileCreateMemoryInstance create_callback; for (idx = 0; (create_callback = @@ -200,8 +200,8 @@ } } - // We didn't find it, so clear our shared pointer in case it - // contains anything and return an empty shared pointer + // 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(); return object_file_sp; } @@ -378,10 +378,8 @@ return eAddressClassUnknown; case eSectionTypeAbsoluteAddress: // In case of absolute sections decide the address class based on - // the symbol - // type because the section type isn't specify if it is a code or a - // data - // section. + // the symbol type because the section type isn't specify if it is + // a code or a data section. break; } } @@ -470,16 +468,14 @@ size_t ObjectFile::GetData(lldb::offset_t offset, size_t length, DataExtractor &data) const { // The entire file has already been mmap'ed into m_data, so just copy from - // there - // as the back mmap buffer will be shared with shared pointers. + // there as the back mmap buffer will be shared with shared pointers. return data.SetData(m_data, offset, length); } size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length, void *dst) const { // The entire file has already been mmap'ed into m_data, so just copy from - // there - // Note that the data remains in target byte order. + // there Note that the data remains in target byte order. return m_data.CopyData(offset, length, dst); } @@ -559,8 +555,8 @@ return GetData(section->GetFileOffset(), section->GetFileSize(), section_data); } else { - // The object file now contains a full mmap'ed copy of the object file data, - // so just use this + // The object file now contains a full mmap'ed copy of the object file + // data, so just use this if (!section->IsRelocated()) RelocateSection(section); Index: lldb/trunk/source/Symbol/Symbol.cpp =================================================================== --- lldb/trunk/source/Symbol/Symbol.cpp +++ lldb/trunk/source/Symbol/Symbol.cpp @@ -122,9 +122,9 @@ ConstString Symbol::GetReExportedSymbolName() const { if (m_type == eSymbolTypeReExported) { - // For eSymbolTypeReExported, the "const char *" from a ConstString - // is used as the offset in the address range base address. We can - // then make this back into a string that is the re-exported name. + // For eSymbolTypeReExported, the "const char *" from a ConstString is used + // as the offset in the address range base address. We can then make this + // back into a string that is the re-exported name. intptr_t str_ptr = m_addr_range.GetBaseAddress().GetOffset(); if (str_ptr != 0) return ConstString((const char *)str_ptr); @@ -136,9 +136,9 @@ FileSpec Symbol::GetReExportedSymbolSharedLibrary() const { if (m_type == eSymbolTypeReExported) { - // For eSymbolTypeReExported, the "const char *" from a ConstString - // is used as the offset in the address range base address. We can - // then make this back into a string that is the re-exported name. + // For eSymbolTypeReExported, the "const char *" from a ConstString is used + // as the offset in the address range base address. We can then make this + // back into a string that is the re-exported name. intptr_t str_ptr = m_addr_range.GetByteSize(); if (str_ptr != 0) return FileSpec((const char *)str_ptr, false); @@ -148,15 +148,15 @@ void Symbol::SetReExportedSymbolName(const ConstString &name) { SetType(eSymbolTypeReExported); - // For eSymbolTypeReExported, the "const char *" from a ConstString - // is used as the offset in the address range base address. + // For eSymbolTypeReExported, the "const char *" from a ConstString is used + // as the offset in the address range base address. m_addr_range.GetBaseAddress().SetOffset((uintptr_t)name.GetCString()); } bool Symbol::SetReExportedSymbolSharedLibrary(const FileSpec &fspec) { if (m_type == eSymbolTypeReExported) { - // For eSymbolTypeReExported, the "const char *" from a ConstString - // is used as the offset in the address range base address. + // For eSymbolTypeReExported, the "const char *" from a ConstString is used + // as the offset in the address range base address. m_addr_range.SetByteSize( (uintptr_t)ConstString(fspec.GetPath().c_str()).GetCString()); return true; @@ -262,9 +262,8 @@ Function *function = base_address.CalculateSymbolContextFunction(); if (function) { // Functions have line entries which can also potentially have end of - // prologue information. - // So if this symbol points to a function, use the prologue information - // from there. + // prologue information. So if this symbol points to a function, use + // the prologue information from there. m_type_data = function->GetPrologueByteSize(); } else { ModuleSP module_sp(base_address.GetModule()); @@ -280,10 +279,9 @@ Address addr(base_address); addr.Slide(m_type_data); - // Check the first few instructions and look for one that has a line - // number that is - // different than the first entry. This is also done in - // Function::GetPrologueByteSize(). + // Check the first few instructions and look for one that has a + // line number that is different than the first entry. This is also + // done in Function::GetPrologueByteSize(). uint16_t total_offset = m_type_data; for (int idx = 0; idx < 6; ++idx) { SymbolContext sc_temp; @@ -293,8 +291,8 @@ if (!(resolved_flags & eSymbolContextLineEntry)) break; - // If this line number is different than our first one, use it and - // we're done. + // If this line number is different than our first one, use it + // and we're done. if (sc_temp.line_entry.line != sc.line_entry.line) { m_type_data = total_offset; break; @@ -309,12 +307,10 @@ } // Sanity check - this may be a function in the middle of code that - // has debug information, but - // not for this symbol. So the line entries surrounding us won't - // lie inside our function. - // In that case, the line entry will be bigger than we are, so we do - // that quick check and - // if that is true, we just return 0. + // has debug information, but not for this symbol. So the line + // entries surrounding us won't lie inside our function. In that + // case, the line entry will be bigger than we are, so we do that + // quick check and if that is true, we just return 0. if (m_type_data >= m_addr_range.GetByteSize()) m_type_data = 0; } else { @@ -420,9 +416,9 @@ // Try searching for the module file spec first using the full path module_sp = target.GetImages().FindFirstModule(module_spec); if (!module_sp) { - // Next try and find the module by basename in case environment - // variables or other runtime trickery causes shared libraries - // to be loaded from alternate paths + // Next try and find the module by basename in case environment variables + // or other runtime trickery causes shared libraries to be loaded from + // alternate paths module_spec.GetFileSpec().GetDirectory().Clear(); module_sp = target.GetImages().FindFirstModule(module_spec); } @@ -430,8 +426,7 @@ if (module_sp) { // There should not be cycles in the reexport list, but we don't want to - // crash if there are so make sure - // we haven't seen this before: + // crash if there are so make sure we haven't seen this before: if (!seen_modules.AppendIfNeeded(module_sp)) return nullptr; @@ -449,8 +444,8 @@ } } // If we didn't find the symbol in this module, it may be because this - // module re-exports some - // whole other library. We have to search those as well: + // module re-exports some whole other library. We have to search those as + // well: seen_modules.Append(module_sp); FileSpecList reexported_libraries = Index: lldb/trunk/source/Symbol/SymbolContext.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolContext.cpp +++ lldb/trunk/source/Symbol/SymbolContext.cpp @@ -359,8 +359,7 @@ if (block != nullptr) *s << " {0x" << block->GetID() << '}'; // Dump the block and pass it a negative depth to we print all the parent - // blocks - // if (block != NULL) + // blocks if (block != NULL) // block->Dump(s, function->GetFileAddress(), INT_MIN); s->EOL(); s->Indent(); @@ -468,27 +467,27 @@ if (block) { // const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress(); - // In order to get the parent of an inlined function we first need to - // see if we are in an inlined block as "this->block" could be an - // inlined block, or a parent of "block" could be. So lets check if - // this block or one of this blocks parents is an inlined function. + // In order to get the parent of an inlined function we first need to see + // if we are in an inlined block as "this->block" could be an inlined + // block, or a parent of "block" could be. So lets check if this block or + // one of this blocks parents is an inlined function. Block *curr_inlined_block = block->GetContainingInlinedBlock(); if (curr_inlined_block) { - // "this->block" is contained in an inline function block, so to - // get the scope above the inlined block, we get the parent of the - // inlined block itself + // "this->block" is contained in an inline function block, so to get the + // scope above the inlined block, we get the parent of the inlined block + // itself Block *next_frame_block = curr_inlined_block->GetParent(); // Now calculate the symbol context of the containing block next_frame_block->CalculateSymbolContext(&next_frame_sc); // If we get here we weren't able to find the return line entry using the - // nesting of the blocks and - // the line table. So just use the call site info from our inlined block. + // nesting of the blocks and the line table. So just use the call site + // info from our inlined block. AddressRange range; if (curr_inlined_block->GetRangeContainingAddress(curr_frame_pc, range)) { - // To see there this new frame block it, we need to look at the - // call site information from + // To see there this new frame block it, we need to look at the call + // site information from const InlineFunctionInfo *curr_inlined_block_inlined_info = curr_inlined_block->GetInlinedFunctionInfo(); next_frame_pc = range.GetBaseAddress(); @@ -550,22 +549,22 @@ Block *SymbolContext::GetFunctionBlock() { if (function) { if (block) { - // If this symbol context has a block, check to see if this block - // is itself, or is contained within a block with inlined function - // information. If so, then the inlined block is the block that - // defines the function. + // If this symbol context has a block, check to see if this block is + // itself, or is contained within a block with inlined function + // information. If so, then the inlined block is the block that defines + // the function. Block *inlined_block = block->GetContainingInlinedBlock(); if (inlined_block) return inlined_block; - // The block in this symbol context is not inside an inlined - // block, so the block that defines the function is the function's - // top level block, which is returned below. + // The block in this symbol context is not inside an inlined block, so + // the block that defines the function is the function's top level block, + // which is returned below. } - // There is no block information in this symbol context, so we must - // assume that the block that is desired is the top level block of - // the function itself. + // There is no block information in this symbol context, so we must assume + // that the block that is desired is the top level block of the function + // itself. return &function->GetBlock(true); } return nullptr; @@ -594,8 +593,8 @@ isInlinedblock = true; //---------------------------------------------------------------------- - // Find all types that match the current block if we have one and put - // them first in the list. Keep iterating up through all blocks. + // Find all types that match the current block if we have one and put them + // first in the list. Keep iterating up through all blocks. //---------------------------------------------------------------------- while (curr_block != nullptr && !isInlinedblock) { type_map.ForEach( @@ -606,8 +605,8 @@ return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating type_list.ForEach([&type_map](const lldb::TypeSP &type_sp) -> bool { type_map.Remove(type_sp); return true; // Keep iterating @@ -615,8 +614,8 @@ curr_block = curr_block->GetParent(); } //---------------------------------------------------------------------- - // Find all types that match the current function, if we have onem, and - // put them next in the list. + // Find all types that match the current function, if we have onem, and put + // them next in the list. //---------------------------------------------------------------------- if (function != nullptr && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -627,8 +626,8 @@ return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -636,8 +635,8 @@ } } //---------------------------------------------------------------------- - // Find all types that match the current compile unit, if we have one, - // and put them next in the list. + // Find all types that match the current compile unit, if we have one, and + // put them next in the list. //---------------------------------------------------------------------- if (comp_unit != nullptr && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -649,8 +648,8 @@ return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -658,8 +657,8 @@ } } //---------------------------------------------------------------------- - // Find all types that match the current module, if we have one, and put - // them next in the list. + // Find all types that match the current module, if we have one, and put them + // next in the list. //---------------------------------------------------------------------- if (module_sp && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -669,8 +668,8 @@ type_list.Insert(type_sp); return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -831,9 +830,9 @@ case eSymbolTypeObjCMetaClass: case eSymbolTypeObjCIVar: if (symbol->GetDemangledNameIsSynthesized()) { - // If the demangled name was synthesized, then don't use it - // for expressions. Only let the symbol match if the mangled - // named matches for these symbols. + // If the demangled name was synthesized, then don't use it for + // expressions. Only let the symbol match if the mangled named + // matches for these symbols. if (symbol->GetMangled().GetMangledName() != name) break; } @@ -861,8 +860,8 @@ target.GetImages().FindFirstModule(reexport_module_spec); } } - // Don't allow us to try and resolve a re-exported symbol if it is - // the same as the current symbol + // Don't allow us to try and resolve a re-exported symbol if it + // is the same as the current symbol if (name == symbol->GetReExportedSymbolName() && module == reexport_module_sp.get()) return nullptr; @@ -1012,9 +1011,8 @@ } break; case eFileSpecified: // CompUnits can't necessarily be resolved here, since an inlined function - // might show up in - // a number of CompUnits. Instead we just convert to a FileSpec and store - // it away. + // might show up in a number of CompUnits. Instead we just convert to a + // FileSpec and store it away. m_file_spec_ap.reset(new FileSpec(spec_string, false)); m_type |= eFileSpecified; break; Index: lldb/trunk/source/Symbol/SymbolFile.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolFile.cpp +++ lldb/trunk/source/Symbol/SymbolFile.cpp @@ -30,8 +30,7 @@ if (obj_file != nullptr) { // We need to test the abilities of this section list. So create what it - // would - // be with this new obj_file. + // would be with this new obj_file. lldb::ModuleSP module_sp(obj_file->GetModule()); if (module_sp) { // Default to the main module section list. @@ -60,16 +59,16 @@ if (sym_file_abilities > best_symfile_abilities) { best_symfile_abilities = sym_file_abilities; best_symfile_ap.reset(curr_symfile_ap.release()); - // If any symbol file parser has all of the abilities, then - // we should just stop looking. + // If any symbol file parser has all of the abilities, then we should + // just stop looking. if ((kAllAbilities & sym_file_abilities) == kAllAbilities) break; } } } if (best_symfile_ap.get()) { - // Let the winning symbol file parser initialize itself more - // completely now that it has been chosen + // Let the winning symbol file parser initialize itself more completely + // now that it has been chosen best_symfile_ap->InitializeObject(); } } Index: lldb/trunk/source/Symbol/SymbolVendor.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp +++ lldb/trunk/source/Symbol/SymbolVendor.cpp @@ -26,9 +26,9 @@ //---------------------------------------------------------------------- // FindPlugin // -// Platforms can register a callback to use when creating symbol -// vendors to allow for complex debug information file setups, and to -// also allow for finding separate debug information files. +// Platforms can register a callback to use when creating symbol vendors to +// allow for complex debug information file setups, and to also allow for +// finding separate debug information files. //---------------------------------------------------------------------- SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm) { @@ -45,8 +45,8 @@ return instance_ap.release(); } } - // The default implementation just tries to create debug information using the - // file representation for the module. + // The default implementation just tries to create debug information using + // the file representation for the module. instance_ap.reset(new SymbolVendor(module_sp)); if (instance_ap.get()) { ObjectFile *objfile = module_sp->GetObjectFile(); @@ -88,11 +88,11 @@ std::lock_guard guard(module_sp->GetMutex()); const size_t num_compile_units = GetNumCompileUnits(); if (idx < num_compile_units) { - // Fire off an assertion if this compile unit already exists for now. - // The partial parsing should take care of only setting the compile - // unit once, so if this assertion fails, we need to make sure that - // we don't have a race condition, or have a second parse of the same - // compile unit. + // Fire off an assertion if this compile unit already exists for now. The + // partial parsing should take care of only setting the compile unit + // once, so if this assertion fails, we need to make sure that we don't + // have a race condition, or have a second parse of the same compile + // unit. assert(m_compile_units[idx].get() == nullptr); m_compile_units[idx] = cu_sp; return true; @@ -111,10 +111,10 @@ std::lock_guard guard(module_sp->GetMutex()); if (m_compile_units.empty()) { if (m_sym_file_ap.get()) { - // Resize our array of compile unit shared pointers -- which will - // each remain NULL until someone asks for the actual compile unit - // information. When this happens, the symbol file will be asked - // to parse this compile unit information. + // Resize our array of compile unit shared pointers -- which will each + // remain NULL until someone asks for the actual compile unit + // information. When this happens, the symbol file will be asked to + // parse this compile unit information. m_compile_units.resize(m_sym_file_ap->GetNumCompileUnits()); } } Index: lldb/trunk/source/Symbol/Symtab.cpp =================================================================== --- lldb/trunk/source/Symbol/Symtab.cpp +++ lldb/trunk/source/Symbol/Symtab.cpp @@ -100,9 +100,8 @@ } break; case eSortOrderByName: { - // Although we maintain a lookup by exact name map, the table - // isn't sorted by name. So we must make the ordered symbol list - // up ourselves. + // Although we maintain a lookup by exact name map, the table isn't + // sorted by name. So we must make the ordered symbol list up ourselves. s->PutCString(" (sorted by name):\n"); DumpSymbolHeader(s); typedef std::multimapIsTrampoline()) continue; @@ -293,10 +291,9 @@ mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus)); entry.cstring = ConstString(cxx_method.GetBasename()); if (entry.cstring) { - // ConstString objects permanently store the string in the pool so - // calling - // GetCString() on the value gets us a const char * that will - // never go away + // ConstString objects permanently store the string in the pool + // so calling GetCString() on the value gets us a const char * + // that will never go away const char *const_context = ConstString(cxx_method.GetContext()).GetCString(); @@ -312,25 +309,25 @@ if (entry_ref[0] == '~' || !cxx_method.GetQualifiers().empty()) { // The first character of the demangled basename is '~' which - // means we have a class destructor. We can use this information - // to help us know what is a class and what isn't. + // means we have a class destructor. We can use this + // information to help us know what is a class and what + // isn't. if (class_contexts.find(const_context) == class_contexts.end()) class_contexts.insert(const_context); m_method_to_index.Append(entry); } else { if (class_contexts.find(const_context) != class_contexts.end()) { - // The current decl context is in our "class_contexts" which - // means - // this is a method on a class + // The current decl context is in our "class_contexts" + // which means this is a method on a class m_method_to_index.Append(entry); } else { - // We don't know if this is a function basename or a method, - // so put it into a temporary collection so once we are done - // we can look in class_contexts to see if each entry is a - // class - // or just a function and will put any remaining items into - // m_method_to_index or m_basename_to_index as needed + // We don't know if this is a function basename or a + // method, so put it into a temporary collection so once we + // are done we can look in class_contexts to see if each + // entry is a class or just a function and will put any + // remaining items into m_method_to_index or + // m_basename_to_index as needed mangled_name_to_index.Append(entry); symbol_contexts[entry.value] = const_context; } @@ -354,9 +351,8 @@ } } - // If the demangled name turns out to be an ObjC name, and - // is a category name, add the version without categories to the index - // too. + // If the demangled name turns out to be an ObjC name, and is a category + // name, add the version without categories to the index too. ObjCLanguage::MethodName objc_method(entry.cstring.GetStringRef(), true); if (objc_method.IsValid(true)) { entry.cstring = objc_method.GetSelector(); @@ -383,8 +379,7 @@ m_method_to_index.Append(entry); } else { // If we got here, we have something that had a context (was inside - // a namespace or class) - // yet we don't know if the entry + // a namespace or class) yet we don't know if the entry m_method_to_index.Append(entry); m_basename_to_index.Append(entry); } @@ -520,20 +515,15 @@ std::vector &addr_cache; // Getting from the symbol to the Address to the File Address involves some - // work. - // Since there are potentially many symbols here, and we're using this for - // sorting so - // we're going to be computing the address many times, cache that in - // addr_cache. - // The array passed in has to be the same size as the symbols array passed - // into the - // member variable symbols, and should be initialized with - // LLDB_INVALID_ADDRESS. + // work. Since there are potentially many symbols here, and we're using this + // for sorting so we're going to be computing the address many times, cache + // that in addr_cache. The array passed in has to be the same size as the + // symbols array passed into the member variable symbols, and should be + // initialized with LLDB_INVALID_ADDRESS. // NOTE: You have to make addr_cache externally and pass it in because // std::stable_sort // makes copies of the comparator it is initially passed in, and you end up - // spending - // huge amounts of time copying this array... + // spending huge amounts of time copying this array... SymbolIndexComparator(const std::vector &s, std::vector &a) @@ -584,8 +574,7 @@ // NOTE: The use of std::stable_sort instead of std::sort here is strictly for // performance, // not correctness. The indexes vector tends to be "close" to sorted, which - // the - // stable sort handles better. + // the stable sort handles better. std::vector addr_cache(m_symbols.size(), LLDB_INVALID_ADDRESS); @@ -752,14 +741,14 @@ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION); - // Initialize all of the lookup by name indexes before converting NAME - // to a uniqued string NAME_STR below. + // Initialize all of the lookup by name indexes before converting NAME to a + // uniqued string NAME_STR below. if (!m_name_indexes_computed) InitNameIndexes(); if (name) { - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_indexes); } return symbol_indexes.size(); @@ -772,14 +761,14 @@ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION); - // Initialize all of the lookup by name indexes before converting NAME - // to a uniqued string NAME_STR below. + // Initialize all of the lookup by name indexes before converting NAME to a + // uniqued string NAME_STR below. if (!m_name_indexes_computed) InitNameIndexes(); if (name) { - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type, symbol_visibility, symbol_indexes); } @@ -810,8 +799,8 @@ if (name) { std::vector matching_indexes; - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. if (AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type, symbol_visibility, matching_indexes)) { @@ -835,8 +824,8 @@ addr_t match_offset; } SymbolSearchInfo; -// Add all the section file start address & size to the RangeVector, -// recusively adding any children sections. +// Add all the section file start address & size to the RangeVector, recusively +// adding any children sections. static void AddSectionsToRangeMap(SectionList *sectlist, RangeVector §ion_ranges) { const int num_sections = sectlist->GetNumSections(0); @@ -885,9 +874,9 @@ // Create a RangeVector with the start & size of all the sections for // this objfile. We'll need to check this for any FileRangeToIndexMap - // entries with an uninitialized size, which could potentially be a - // large number so reconstituting the weak pointer is busywork when it - // is invariant information. + // entries with an uninitialized size, which could potentially be a large + // number so reconstituting the weak pointer is busywork when it is + // invariant information. SectionList *sectlist = m_objfile->GetSectionList(); RangeVector section_ranges; if (sectlist) { @@ -922,9 +911,8 @@ if (next_base_addr > curr_base_addr) { addr_t size_to_next_symbol = next_base_addr - curr_base_addr; - // Take the difference between this symbol and the next one as its - // size, - // if it is less than the size of the section. + // Take the difference between this symbol and the next one as + // its size, if it is less than the size of the section. if (sym_size == 0 || size_to_next_symbol < sym_size) { sym_size = size_to_next_symbol; } @@ -958,8 +946,7 @@ for (size_t i = 0; i < num_entries; ++i) { // The entries in the m_file_addr_to_index have calculated the sizes - // already - // so we will use this size if we need to. + // already so we will use this size if we need to. const FileRangeToIndexMap::Entry &entry = m_file_addr_to_index.GetEntryRef(i); @@ -1086,8 +1073,8 @@ } if (name_type_mask & eFunctionNameTypeBase) { - // From mangled names we can't tell what is a basename and what - // is a method name, so we just treat them the same + // From mangled names we can't tell what is a basename and what is a method + // name, so we just treat them the same if (!m_name_indexes_computed) InitNameIndexes(); Index: lldb/trunk/source/Symbol/Type.cpp =================================================================== --- lldb/trunk/source/Symbol/Type.cpp +++ lldb/trunk/source/Symbol/Type.cpp @@ -387,8 +387,8 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, AddressType address_type, DataExtractor &data) { if (address_type == eAddressTypeFile) { - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context + // (which Module it came from) return false; } @@ -533,10 +533,8 @@ } // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is - // set to eResolveStateUnresolved - // so we need to update it to say that we now have a forward declaration - // since that is what we created - // above. + // set to eResolveStateUnresolved so we need to update it to say that we + // now have a forward declaration since that is what we created above. if (m_compiler_type.IsValid()) m_flags.compiler_type_resolve_state = eResolveStateForward; } @@ -556,8 +554,8 @@ } } - // If we have an encoding type, then we need to make sure it is - // resolved appropriately. + // If we have an encoding type, then we need to make sure it is resolved + // appropriately. if (m_encoding_uid != LLDB_INVALID_UID) { if (encoding_type == nullptr) encoding_type = GetEncodingType(); @@ -847,35 +845,26 @@ } bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const { - // Check if we have a module for this type. If we do and the shared pointer is - // can be successfully initialized with m_module_wp, return true. Else return - // false - // if we didn't have a module, or if we had a module and it has been deleted. - // Any - // functions doing anything with a TypeSP in this TypeImpl class should call - // this - // function and only do anything with the ivars if this function returns true. - // If - // we have a module, the "module_sp" will be filled in with a strong reference - // to the - // module so that the module will at least stay around long enough for the - // type - // query to succeed. + // Check if we have a module for this type. If we do and the shared pointer + // is can be successfully initialized with m_module_wp, return true. Else + // return false if we didn't have a module, or if we had a module and it has + // been deleted. Any functions doing anything with a TypeSP in this TypeImpl + // class should call this function and only do anything with the ivars if + // this function returns true. If we have a module, the "module_sp" will be + // filled in with a strong reference to the module so that the module will at + // least stay around long enough for the type query to succeed. module_sp = m_module_wp.lock(); if (!module_sp) { lldb::ModuleWP empty_module_wp; // If either call to "std::weak_ptr::owner_before(...) value returns true, - // this - // indicates that m_module_wp once contained (possibly still does) a - // reference - // to a valid shared pointer. This helps us know if we had a valid reference - // to - // a section which is now invalid because the module it was in was deleted + // this indicates that m_module_wp once contained (possibly still does) a + // reference to a valid shared pointer. This helps us know if we had a + // valid reference to a section which is now invalid because the module it + // was in was deleted if (empty_module_wp.owner_before(m_module_wp) || m_module_wp.owner_before(empty_module_wp)) { // m_module_wp had a valid reference to a module, but all strong - // references - // have been released and the module has been deleted + // references have been released and the module has been deleted return false; } } Index: lldb/trunk/source/Symbol/TypeList.cpp =================================================================== --- lldb/trunk/source/Symbol/TypeList.cpp +++ lldb/trunk/source/Symbol/TypeList.cpp @@ -32,7 +32,8 @@ TypeList::~TypeList() {} void TypeList::Insert(const TypeSP &type_sp) { - // Just push each type on the back for now. We will worry about uniquing later + // Just push each type on the back for now. We will worry about uniquing + // later if (type_sp) m_types.push_back(type_sp); } @@ -123,10 +124,10 @@ void TypeList::RemoveMismatchedTypes(const std::string &type_scope, const std::string &type_basename, TypeClass type_class, bool exact_match) { - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); @@ -161,19 +162,15 @@ if (type_scope_pos == match_type_scope_size - type_scope_size) { if (type_scope_pos >= 2) { // Our match scope ends with the type scope we were looking - // for, - // but we need to make sure what comes before the matching - // type scope is a namespace boundary in case we are trying to - // match: - // type_basename = "d" - // type_scope = "b::c::" + // for, but we need to make sure what comes before the + // matching type scope is a namespace boundary in case we are + // trying to match: type_basename = "d" type_scope = "b::c::" // We want to match: // match_type_scope "a::b::c::" // But not: // match_type_scope "a::bb::c::" // So below we make sure what comes before "b::c::" in - // match_type_scope - // is "::", or the namespace boundary + // match_type_scope is "::", or the namespace boundary if (match_type_scope[type_scope_pos - 1] == ':' && match_type_scope[type_scope_pos - 2] == ':') { keep_match = true; @@ -184,9 +181,8 @@ } } } else { - // The type we are currently looking at doesn't exists - // in a namespace or class, so it only matches if there - // is no type scope... + // The type we are currently looking at doesn't exists in a namespace + // or class, so it only matches if there is no type scope... keep_match = type_scope.empty() && type_basename.compare(match_type_name) == 0; } @@ -203,10 +199,10 @@ if (type_class == eTypeClassAny) return; - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); Index: lldb/trunk/source/Symbol/TypeMap.cpp =================================================================== --- lldb/trunk/source/Symbol/TypeMap.cpp +++ lldb/trunk/source/Symbol/TypeMap.cpp @@ -45,7 +45,8 @@ TypeMap::~TypeMap() {} void TypeMap::Insert(const TypeSP &type_sp) { - // Just push each type on the back for now. We will worry about uniquing later + // Just push each type on the back for now. We will worry about uniquing + // later if (type_sp) m_types.insert(std::make_pair(type_sp->GetID(), type_sp)); } @@ -167,10 +168,10 @@ void TypeMap::RemoveMismatchedTypes(const std::string &type_scope, const std::string &type_basename, TypeClass type_class, bool exact_match) { - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); @@ -205,19 +206,15 @@ if (type_scope_pos == match_type_scope_size - type_scope_size) { if (type_scope_pos >= 2) { // Our match scope ends with the type scope we were looking - // for, - // but we need to make sure what comes before the matching - // type scope is a namespace boundary in case we are trying to - // match: - // type_basename = "d" - // type_scope = "b::c::" + // for, but we need to make sure what comes before the + // matching type scope is a namespace boundary in case we are + // trying to match: type_basename = "d" type_scope = "b::c::" // We want to match: // match_type_scope "a::b::c::" // But not: // match_type_scope "a::bb::c::" // So below we make sure what comes before "b::c::" in - // match_type_scope - // is "::", or the namespace boundary + // match_type_scope is "::", or the namespace boundary if (match_type_scope[type_scope_pos - 1] == ':' && match_type_scope[type_scope_pos - 2] == ':') { keep_match = true; @@ -228,9 +225,8 @@ } } } else { - // The type we are currently looking at doesn't exists - // in a namespace or class, so it only matches if there - // is no type scope... + // The type we are currently looking at doesn't exists in a namespace + // or class, so it only matches if there is no type scope... keep_match = type_scope.empty() && type_basename.compare(match_type_name) == 0; } @@ -247,10 +243,10 @@ if (type_class == eTypeClassAny) return; - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); Index: lldb/trunk/source/Symbol/UnwindPlan.cpp =================================================================== --- lldb/trunk/source/Symbol/UnwindPlan.cpp +++ lldb/trunk/source/Symbol/UnwindPlan.cpp @@ -46,8 +46,7 @@ } // This function doesn't copy the dwarf expression bytes; they must remain in -// allocated -// memory for the lifespan of this UnwindPlan object. +// allocated memory for the lifespan of this UnwindPlan object. void UnwindPlan::Row::RegisterLocation::SetAtDWARFExpression( const uint8_t *opcodes, uint32_t len) { m_type = atDWARFExpression; @@ -56,8 +55,7 @@ } // This function doesn't copy the dwarf expression bytes; they must remain in -// allocated -// memory for the lifespan of this UnwindPlan object. +// allocated memory for the lifespan of this UnwindPlan object. void UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression( const uint8_t *opcodes, uint32_t len) { m_type = isDWARFExpression; Index: lldb/trunk/source/Symbol/UnwindTable.cpp =================================================================== --- lldb/trunk/source/Symbol/UnwindTable.cpp +++ lldb/trunk/source/Symbol/UnwindTable.cpp @@ -20,10 +20,9 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" -// There is one UnwindTable object per ObjectFile. -// It contains a list of Unwind objects -- one per function, populated lazily -- -// for the ObjectFile. -// Each Unwind object has multiple UnwindPlans for different scenarios. +// There is one UnwindTable object per ObjectFile. It contains a list of Unwind +// objects -- one per function, populated lazily -- for the ObjectFile. Each +// Unwind object has multiple UnwindPlans for different scenarios. using namespace lldb; using namespace lldb_private; @@ -33,8 +32,7 @@ m_eh_frame_up(), m_compact_unwind_up(), m_arm_unwind_up() {} // We can't do some of this initialization when the ObjectFile is running its -// ctor; delay doing it -// until needed for something. +// ctor; delay doing it until needed for something. void UnwindTable::Initialize() { if (m_initialized) @@ -134,10 +132,9 @@ } // Ignore any existing FuncUnwinders for this function, create a new one and -// don't add it to the -// UnwindTable. This is intended for use by target modules show-unwind where we -// want to create -// new UnwindPlans, not re-use existing ones. +// don't add it to the UnwindTable. This is intended for use by target modules +// show-unwind where we want to create new UnwindPlans, not re-use existing +// ones. FuncUnwindersSP UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc) { Index: lldb/trunk/source/Symbol/Variable.cpp =================================================================== --- lldb/trunk/source/Symbol/Variable.cpp +++ lldb/trunk/source/Symbol/Variable.cpp @@ -239,9 +239,8 @@ target_sp.get()); if (loclist_base_load_addr == LLDB_INVALID_ADDRESS) return false; - // It is a location list. We just need to tell if the location - // list contains the current address when converted to a load - // address + // It is a location list. We just need to tell if the location list + // contains the current address when converted to a load address return m_location.LocationListContainsAddress( loclist_base_load_addr, frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get())); @@ -251,8 +250,8 @@ } bool Variable::LocationIsValidForAddress(const Address &address) { - // Be sure to resolve the address to section offset prior to - // calling this function. + // Be sure to resolve the address to section offset prior to calling this + // function. if (address.IsSectionOffset()) { SymbolContext sc; CalculateSymbolContext(&sc); @@ -268,9 +267,8 @@ sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) return false; - // It is a location list. We just need to tell if the location - // list contains the current address when converted to a load - // address + // It is a location list. We just need to tell if the location list + // contains the current address when converted to a load address return m_location.LocationListContainsAddress(loclist_base_file_addr, address.GetFileAddress()); } @@ -294,8 +292,8 @@ case eValueTypeVariableArgument: case eValueTypeVariableLocal: if (frame) { - // We don't have a location list, we just need to see if the block - // that this variable was defined in is currently + // We don't have a location list, we just need to see if the block that + // this variable was defined in is currently Block *deepest_frame_block = frame->GetSymbolContext(eSymbolContextBlock).block; if (deepest_frame_block) { @@ -313,8 +311,7 @@ return false; // If no scope range is specified then it means that the scope is the - // same as the - // scope of the enclosing lexical block. + // same as the scope of the enclosing lexical block. if (m_scope_range.IsEmpty()) return true; @@ -455,8 +452,8 @@ } bool Variable::DumpLocationForAddress(Stream *s, const Address &address) { - // Be sure to resolve the address to section offset prior to - // calling this function. + // Be sure to resolve the address to section offset prior to calling this + // function. if (address.IsSectionOffset()) { SymbolContext sc; CalculateSymbolContext(&sc); Index: lldb/trunk/source/Target/ABI.cpp =================================================================== --- lldb/trunk/source/Target/ABI.cpp +++ lldb/trunk/source/Target/ABI.cpp @@ -193,18 +193,18 @@ bool ABI::GetFallbackRegisterLocation( const RegisterInfo *reg_info, UnwindPlan::Row::RegisterLocation &unwind_regloc) { - // Did the UnwindPlan fail to give us the caller's stack pointer? - // The stack pointer is defined to be the same as THIS frame's CFA, so return - // the CFA value as - // the caller's stack pointer. This is true on x86-32/x86-64 at least. + // Did the UnwindPlan fail to give us the caller's stack pointer? The stack + // pointer is defined to be the same as THIS frame's CFA, so return the CFA + // value as the caller's stack pointer. This is true on x86-32/x86-64 at + // least. if (reg_info->kinds[eRegisterKindGeneric] == LLDB_REGNUM_GENERIC_SP) { unwind_regloc.SetIsCFAPlusOffset(0); return true; } // If a volatile register is being requested, we don't want to forward the - // next frame's register contents - // up the stack -- the register is not retrievable at this frame. + // next frame's register contents up the stack -- the register is not + // retrievable at this frame. if (RegisterIsVolatile(reg_info)) { unwind_regloc.SetUndefined(); return true; Index: lldb/trunk/source/Target/ExecutionContext.cpp =================================================================== --- lldb/trunk/source/Target/ExecutionContext.cpp +++ lldb/trunk/source/Target/ExecutionContext.cpp @@ -369,15 +369,14 @@ bool ExecutionContext::operator==(const ExecutionContext &rhs) const { // Check that the frame shared pointers match, or both are valid and their - // stack - // IDs match since sometimes we get new objects that represent the same + // stack IDs match since sometimes we get new objects that represent the same // frame within a thread. if ((m_frame_sp == rhs.m_frame_sp) || (m_frame_sp && rhs.m_frame_sp && m_frame_sp->GetStackID() == rhs.m_frame_sp->GetStackID())) { - // Check that the thread shared pointers match, or both are valid and - // their thread IDs match since sometimes we get new objects that - // represent the same thread within a process. + // Check that the thread shared pointers match, or both are valid and their + // thread IDs match since sometimes we get new objects that represent the + // same thread within a process. if ((m_thread_sp == rhs.m_thread_sp) || (m_thread_sp && rhs.m_thread_sp && m_thread_sp->GetID() == rhs.m_thread_sp->GetID())) { @@ -596,9 +595,9 @@ lldb::ThreadSP thread_sp(m_thread_wp.lock()); if (m_tid != LLDB_INVALID_THREAD_ID) { - // We check if the thread has been destroyed in cases where clients - // might still have shared pointer to a thread, but the thread is - // not valid anymore (not part of the process) + // We check if the thread has been destroyed in cases where clients might + // still have shared pointer to a thread, but the thread is not valid + // anymore (not part of the process) if (!thread_sp || !thread_sp->IsValid()) { lldb::ProcessSP process_sp(GetProcessSP()); if (process_sp && process_sp->IsValid()) { @@ -608,9 +607,8 @@ } } - // Check that we aren't about to return an invalid thread sp. We might return - // a nullptr thread_sp, - // but don't return an invalid one. + // Check that we aren't about to return an invalid thread sp. We might + // return a nullptr thread_sp, but don't return an invalid one. if (thread_sp && !thread_sp->IsValid()) thread_sp.reset(); Index: lldb/trunk/source/Target/Memory.cpp =================================================================== --- lldb/trunk/source/Target/Memory.cpp +++ lldb/trunk/source/Target/Memory.cpp @@ -133,12 +133,12 @@ Status &error) { size_t bytes_left = dst_len; - // Check the L1 cache for a range that contain the entire memory read. - // If we find a range in the L1 cache that does, we use it. Else we fall - // back to reading memory in m_L2_cache_line_byte_size byte sized chunks. - // The L1 cache contains chunks of memory that are not required to be - // m_L2_cache_line_byte_size bytes in size, so we don't try anything - // tricky when reading from them (no partial reads from the L1 cache). + // Check the L1 cache for a range that contain the entire memory read. If we + // find a range in the L1 cache that does, we use it. Else we fall back to + // reading memory in m_L2_cache_line_byte_size byte sized chunks. The L1 + // cache contains chunks of memory that are not required to be + // m_L2_cache_line_byte_size bytes in size, so we don't try anything tricky + // when reading from them (no partial reads from the L1 cache). std::lock_guard guard(m_mutex); if (!m_L1_cache.empty()) { @@ -155,11 +155,11 @@ } } - // If this memory read request is larger than the cache line size, then - // we (1) try to read as much of it at once as possible, and (2) don't - // add the data to the memory cache. We don't want to split a big read - // up into more separate reads than necessary, and with a large memory read - // request, it is unlikely that the caller function will ask for the next + // If this memory read request is larger than the cache line size, then we + // (1) try to read as much of it at once as possible, and (2) don't add the + // data to the memory cache. We don't want to split a big read up into more + // separate reads than necessary, and with a large memory read request, it is + // unlikely that the caller function will ask for the next // 4 bytes after the large memory read - so there's little benefit to saving // it in the cache. if (dst && dst_len > m_L2_cache_line_byte_size) { @@ -218,9 +218,9 @@ bytes_left -= curr_read_size; curr_addr += curr_read_size; - // We have a cache page that succeeded to read some bytes - // but not an entire page. If this happens, we must cap - // off how much data we are able to read... + // We have a cache page that succeeded to read some bytes but not + // an entire page. If this happens, we must cap off how much data + // we are able to read... if (pos->second->GetByteSize() != cache_line_byte_size) return dst_len - bytes_left; } @@ -277,8 +277,8 @@ if (range_size >= size) { // We found a free block that is big enough for our data. Figure out how - // many chunks we will need and calculate the resulting block size we will - // reserve. + // many chunks we will need and calculate the resulting block size we + // will reserve. addr_t addr = free_block.GetRangeBase(); size_t num_chunks = CalculateChunksNeededForSize(size); lldb::addr_t block_size = num_chunks * m_chunk_size; @@ -296,8 +296,8 @@ // Make the new allocated range and add it to the allocated ranges. Range reserved_block(free_block); reserved_block.SetByteSize(block_size); - // Insert the reserved range and don't combine it with other blocks - // in the reserved blocks list. + // Insert the reserved range and don't combine it with other blocks in + // the reserved blocks list. m_reserved_blocks.Insert(reserved_block, false); // Adjust the free range in place since we won't change the sorted // ordering of the m_free_blocks list. Index: lldb/trunk/source/Target/ModuleCache.cpp =================================================================== --- lldb/trunk/source/Target/ModuleCache.cpp +++ lldb/trunk/source/Target/ModuleCache.cpp @@ -312,9 +312,8 @@ llvm::FileRemover tmp_symfile_remover(tmp_download_sym_file_spec.GetPath()); if (error.Fail()) // Failed to download a symfile but fetching the module was successful. The - // module might - // contain the necessary symbols and the debugging is also possible without - // a symfile. + // module might contain the necessary symbols and the debugging is also + // possible without a symfile. return Status(); error = Put(root_dir_spec, escaped_hostname.c_str(), module_spec, Index: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp =================================================================== --- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp +++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp @@ -170,8 +170,7 @@ UpdateISAToDescriptorMap(); if (m_hash_to_isa_map.empty()) { // No name hashes were provided, we need to just linearly power through - // the - // names and find a match + // the names and find a match for (ISAToDescriptorIterator pos = m_isa_to_descriptor.begin(); pos != end; ++pos) { if (pos->second->GetClassName() == name) @@ -239,9 +238,9 @@ ObjCLanguageRuntime::ClassDescriptorSP ObjCLanguageRuntime::GetClassDescriptor(ValueObject &valobj) { ClassDescriptorSP objc_class_sp; - // if we get an invalid VO (which might still happen when playing around - // with pointers returned by the expression parser, don't consider this - // a valid ObjC object) + // if we get an invalid VO (which might still happen when playing around with + // pointers returned by the expression parser, don't consider this a valid + // ObjC object) if (valobj.GetCompilerType().IsValid()) { addr_t isa_pointer = valobj.GetPointerValue(); if (isa_pointer != LLDB_INVALID_ADDRESS) { Index: lldb/trunk/source/Target/Platform.cpp =================================================================== --- lldb/trunk/source/Target/Platform.cpp +++ lldb/trunk/source/Target/Platform.cpp @@ -46,8 +46,8 @@ #include "llvm/Support/FileSystem.h" -// Define these constants from POSIX mman.h rather than include the file -// so that they will be correct even when compiled on Linux. +// Define these constants from POSIX mman.h rather than include the file so +// that they will be correct even when compiled on Linux. #define MAP_PRIVATE 2 #define MAP_ANON 0x1000 @@ -56,8 +56,8 @@ static uint32_t g_initialize_count = 0; -// Use a singleton function for g_local_platform_sp to avoid init -// constructors since LLDB is often part of a shared library +// Use a singleton function for g_local_platform_sp to avoid init constructors +// since LLDB is often part of a shared library static PlatformSP &GetHostPlatformSP() { static PlatformSP g_platform_sp; return g_platform_sp; @@ -468,10 +468,9 @@ bool fetch = false; if (success) { - // We have valid OS version info, check to make sure it wasn't - // manually set prior to connecting. If it was manually set prior - // to connecting, then lets fetch the actual OS version info - // if we are now connected. + // We have valid OS version info, check to make sure it wasn't manually + // set prior to connecting. If it was manually set prior to connecting, + // then lets fetch the actual OS version info if we are now connected. if (is_connected && !m_os_version_set_while_connected) fetch = true; } else { @@ -490,8 +489,8 @@ minor = m_minor_os_version; update = m_update_os_version; } else if (process) { - // Check with the process in case it can answer the question if - // a process was provided + // Check with the process in case it can answer the question if a process + // was provided return process->GetHostOSVersion(major, minor, update); } return success; @@ -578,8 +577,8 @@ // now recurse std::string src_dir_path(src.GetPath()); - // Make a filespec that only fills in the directory of a FileSpec so - // when we enumerate we can quickly fill in the filename for dst copies + // Make a filespec that only fills in the directory of a FileSpec so when + // we enumerate we can quickly fill in the filename for dst copies FileSpec recurse_dst; recurse_dst.GetDirectory().SetCString(dst_dir.GetPath().c_str()); RecurseCopyBaton rc_baton2 = {recurse_dst, rc_baton->platform_ptr, @@ -657,9 +656,9 @@ if (first_dst_dir_char == '/' || first_dst_dir_char == '\\') { fixed_dst.GetDirectory() = dst.GetDirectory(); } - // If the fixed destination file doesn't have a directory yet, - // then we must have a relative path. We will resolve this relative - // path against the platform's working directory + // If the fixed destination file doesn't have a directory yet, then we + // must have a relative path. We will resolve this relative path against + // the platform's working directory if (!fixed_dst.GetDirectory()) { FileSpec relative_spec; std::string path; @@ -862,21 +861,19 @@ bool Platform::SetOSVersion(uint32_t major, uint32_t minor, uint32_t update) { if (IsHost()) { - // We don't need anyone setting the OS version for the host platform, - // we should be able to figure it out by calling - // HostInfo::GetOSVersion(...). + // We don't need anyone setting the OS version for the host platform, we + // should be able to figure it out by calling HostInfo::GetOSVersion(...). return false; } else { - // We have a remote platform, allow setting the target OS version if - // we aren't connected, since if we are connected, we should be able to + // We have a remote platform, allow setting the target OS version if we + // aren't connected, since if we are connected, we should be able to // request the remote OS version from the connected platform. if (IsConnected()) return false; else { - // We aren't connected and we might want to set the OS version - // ahead of time before we connect so we can peruse files and - // use a local SDK or PDK cache of support files to disassemble - // or do other things. + // We aren't connected and we might want to set the OS version ahead of + // time before we connect so we can peruse files and use a local SDK or + // PDK cache of support files to disassemble or do other things. m_major_os_version = major; m_minor_os_version = minor; m_update_os_version = update; @@ -897,9 +894,9 @@ module_search_paths_ptr, nullptr, nullptr); } else { - // No valid architecture was specified, ask the platform for - // the architectures that we should be using (in the correct order) - // and see if we can find a match that way + // No valid architecture was specified, ask the platform for the + // architectures that we should be using (in the correct order) and see + // if we can find a match that way ModuleSpec arch_module_spec(module_spec); for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, arch_module_spec.GetArchitecture()); @@ -943,18 +940,17 @@ m_system_arch_set_while_connected = m_system_arch.IsValid(); } } else { - // We have a remote platform. We can only fetch the remote - // system architecture if we are connected, and we don't want to do it - // more than once. + // We have a remote platform. We can only fetch the remote system + // architecture if we are connected, and we don't want to do it more than + // once. const bool is_connected = IsConnected(); bool fetch = false; if (m_system_arch.IsValid()) { - // We have valid OS version info, check to make sure it wasn't - // manually set prior to connecting. If it was manually set prior - // to connecting, then lets fetch the actual OS version info - // if we are now connected. + // We have valid OS version info, check to make sure it wasn't manually + // set prior to connecting. If it was manually set prior to connecting, + // then lets fetch the actual OS version info if we are now connected. if (is_connected && !m_system_arch_set_while_connected) fetch = true; } else { @@ -1026,8 +1022,8 @@ bool Platform::GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &process_info) { - // Take care of the host case so that each subclass can just - // call this function to get the host functionality. + // Take care of the host case so that each subclass can just call this + // function to get the host functionality. if (IsHost()) return Host::GetProcessInfo(pid, process_info); return false; @@ -1035,8 +1031,8 @@ uint32_t Platform::FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) { - // Take care of the host case so that each subclass can just - // call this function to get the host functionality. + // Take care of the host case so that each subclass can just call this + // function to get the host functionality. uint32_t match_count = 0; if (IsHost()) match_count = Host::FindProcesses(match_info, process_infos); @@ -1049,8 +1045,8 @@ if (log) log->Printf("Platform::%s()", __FUNCTION__); - // Take care of the host case so that each subclass can just - // call this function to get the host functionality. + // Take care of the host case so that each subclass can just call this + // function to get the host functionality. if (IsHost()) { if (::getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY")) launch_info.GetFlags().Set(eLaunchFlagLaunchInTTY); @@ -1107,8 +1103,7 @@ log->Printf("Platform::%s, pid %" PRIu64, __FUNCTION__, pid); // Try to find a process plugin to handle this Kill request. If we can't, - // fall back to - // the default OS implementation. + // fall back to the default OS implementation. size_t num_debuggers = Debugger::GetNumDebuggers(); for (size_t didx = 0; didx < num_debuggers; ++didx) { DebuggerSP debugger = Debugger::GetDebuggerAtIndex(didx); @@ -1143,23 +1138,22 @@ // Make sure we stop at the entry point launch_info.GetFlags().Set(eLaunchFlagDebug); // We always launch the process we are going to debug in a separate process - // group, since then we can handle ^C interrupts ourselves w/o having to worry - // about the target getting them as well. + // group, since then we can handle ^C interrupts ourselves w/o having to + // worry about the target getting them as well. launch_info.SetLaunchInSeparateProcessGroup(true); // Allow any StructuredData process-bound plugins to adjust the launch info // if needed size_t i = 0; bool iteration_complete = false; - // Note iteration can't simply go until a nullptr callback is returned, as - // it is valid for a plugin to not supply a filter. + // Note iteration can't simply go until a nullptr callback is returned, as it + // is valid for a plugin to not supply a filter. auto get_filter_func = PluginManager::GetStructuredDataFilterCallbackAtIndex; for (auto filter_callback = get_filter_func(i, iteration_complete); !iteration_complete; filter_callback = get_filter_func(++i, iteration_complete)) { if (filter_callback) { - // Give this ProcessLaunchInfo filter a chance to adjust the launch - // info. + // Give this ProcessLaunchInfo filter a chance to adjust the launch info. error = (*filter_callback)(launch_info, target); if (!error.Success()) { if (log) @@ -1192,10 +1186,10 @@ // process if this happens. process_sp->SetShouldDetach(false); - // If we didn't have any file actions, the pseudo terminal might - // have been used where the slave side was given as the file to - // open for stdin/out/err after we have already opened the master - // so we can read/write stdin/out/err. + // If we didn't have any file actions, the pseudo terminal might have + // been used where the slave side was given as the file to open for + // stdin/out/err after we have already opened the master so we can + // read/write stdin/out/err. int pty_fd = launch_info.GetPTY().ReleaseMasterFileDescriptor(); if (pty_fd != PseudoTerminal::invalid_fd) { process_sp->SetSTDIOFileDescriptor(pty_fd); @@ -1314,8 +1308,8 @@ offset += bytes_written; if (bytes_written != bytes_read) { - // We didn't write the correct number of bytes, so adjust - // the file position in the source file we are reading from... + // We didn't write the correct number of bytes, so adjust the file + // position in the source file we are reading from... source_file.SeekFromStart(offset); } } @@ -1600,9 +1594,9 @@ if (module_spec.GetArchitecture().IsValid() == false) { Status error; - // No valid architecture was specified, ask the platform for - // the architectures that we should be using (in the correct order) - // and see if we can find a match that way + // No valid architecture was specified, ask the platform for the + // architectures that we should be using (in the correct order) and see if + // we can find a match that way ModuleSpec arch_module_spec(module_spec); for (uint32_t idx = 0; GetSupportedArchitectureAtIndex( idx, arch_module_spec.GetArchitecture()); @@ -1853,8 +1847,8 @@ // TODO: support big-endian arm and thumb trap codes. case llvm::Triple::arm: { - // The ARM reference recommends the use of 0xe7fddefe and 0xdefe - // but the linux kernel does otherwise. + // The ARM reference recommends the use of 0xe7fddefe and 0xdefe but the + // linux kernel does otherwise. static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7}; static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde}; Index: lldb/trunk/source/Target/Process.cpp =================================================================== --- lldb/trunk/source/Target/Process.cpp +++ lldb/trunk/source/Target/Process.cpp @@ -90,19 +90,18 @@ ProcessOptionValueProperties(const ConstString &name) : OptionValueProperties(name) {} - // This constructor is used when creating ProcessOptionValueProperties when it - // is part of a new lldb_private::Process instance. It will copy all current - // global property values as needed + // This constructor is used when creating ProcessOptionValueProperties when + // it is part of a new lldb_private::Process instance. It will copy all + // current global property values as needed ProcessOptionValueProperties(ProcessProperties *global_properties) : OptionValueProperties(*global_properties->GetValueProperties()) {} const Property *GetPropertyAtIndex(const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const override { - // When getting the value for a key from the process options, we will always - // try and grab the setting from the current process if there is one. Else - // we just - // use the one from this instance. + // When getting the value for a key from the process options, we will + // always try and grab the setting from the current process if there is + // one. Else we just use the one from this instance. if (exe_ctx) { Process *process = exe_ctx->GetProcessPtr(); if (process) { @@ -809,8 +808,8 @@ StopPrivateStateThread(); // ThreadList::Clear() will try to acquire this process's mutex, so - // explicitly clear the thread list here to ensure that the mutex - // is not destroyed before the thread list. + // explicitly clear the thread list here to ensure that the mutex is not + // destroyed before the thread list. m_thread_list.Clear(); } @@ -848,13 +847,12 @@ // Clear our broadcaster before we proceed with destroying Broadcaster::Clear(); - // Do any cleanup needed prior to being destructed... Subclasses - // that override this method should call this superclass method as well. + // Do any cleanup needed prior to being destructed... Subclasses that + // override this method should call this superclass method as well. // We need to destroy the loader before the derived Process class gets - // destroyed - // since it is very likely that undoing the loader will require access to the - // real process. + // destroyed since it is very likely that undoing the loader will require + // access to the real process. m_dynamic_checkers_ap.reset(); m_abi_sp.reset(); m_os_ap.reset(); @@ -874,8 +872,8 @@ m_language_runtimes.clear(); m_instrumentation_runtimes.clear(); m_next_event_action_ap.reset(); - // Clear the last natural stop ID since it has a strong - // reference to this process + // Clear the last natural stop ID since it has a strong reference to this + // process m_mod_id.SetStopEventForLastNaturalStopID(EventSP()); //#ifdef LLDB_CONFIGURATION_DEBUG // StreamFile s(stdout, false); @@ -931,14 +929,11 @@ // FIXME: We need to do some work on events before the general Listener sees // them. // For instance if we are continuing from a breakpoint, we need to ensure that -// we do -// the little "insert real insn, step & stop" trick. But we can't do that when -// the -// event is delivered by the broadcaster - since that is done on the thread that -// is -// waiting for new events, so if we needed more than one event for our handling, -// we would -// stall. So instead we do it when we fetch the event off of the queue. +// we do the little "insert real insn, step & stop" trick. But we can't do +// that when the event is delivered by the broadcaster - since that is done on +// the thread that is waiting for new events, so if we needed more than one +// event for our handling, we would stall. So instead we do it when we fetch +// the event off of the queue. // StateType Process::GetNextEvent(EventSP &event_sp) { @@ -974,15 +969,13 @@ ListenerSP hijack_listener_sp, Stream *stream, bool use_run_lock) { // We can't just wait for a "stopped" event, because the stopped event may - // have restarted the target. - // We have to actually check each event, and in the case of a stopped event - // check the restarted flag - // on the event. + // have restarted the target. We have to actually check each event, and in + // the case of a stopped event check the restarted flag on the event. if (event_sp_ptr) event_sp_ptr->reset(); StateType state = GetState(); - // If we are exited or detached, we won't ever get back to any - // other valid state... + // If we are exited or detached, we won't ever get back to any other valid + // state... if (state == eStateDetached || state == eStateExited) return state; @@ -1148,10 +1141,8 @@ case eStopReasonSignal: { // Don't select a signal thread if we weren't going to stop at - // that - // signal. We have to have had another reason for stopping here, - // and - // the user doesn't want to see this thread. + // that signal. We have to have had another reason for stopping + // here, and the user doesn't want to see this thread. uint64_t signo = thread->GetStopInfo()->GetValue(); if (process_sp->GetUnixSignals()->GetShouldStop(signo)) { if (!other_thread) @@ -1191,10 +1182,9 @@ } } // Drop the ThreadList mutex by here, since GetThreadStatus below might - // have to run code, - // e.g. for Data formatters, and if we hold the ThreadList mutex, then the - // process is going to - // have a hard time restarting the process. + // have to run code, e.g. for Data formatters, and if we hold the + // ThreadList mutex, then the process is going to have a hard time + // restarting the process. if (stream) { Debugger &debugger = process_sp->GetTarget().GetDebugger(); if (debugger.GetTargetList().GetSelectedTarget().get() == @@ -1382,8 +1372,8 @@ else m_exit_string.clear(); - // Clear the last natural stop ID since it has a strong - // reference to this process + // Clear the last natural stop ID since it has a strong reference to this + // process m_mod_id.SetStopEventForLastNaturalStopID(EventSP()); SetPrivateState(eStateExited); @@ -1410,9 +1400,9 @@ } } -// This static callback can be used to watch for local child processes on -// the current host. The child process exits, the process will be -// found in the global target list (we want to be completely sure that the +// This static callback can be used to watch for local child processes on the +// current host. The child process exits, the process will be found in the +// global target list (we want to be completely sure that the // lldb_private::Process doesn't go away before we can deliver the signal. bool Process::SetProcessExitStatus( lldb::pid_t pid, bool exited, @@ -1449,20 +1439,19 @@ const StateType state = GetPrivateState(); if (StateIsStoppedState(state, true)) { std::lock_guard guard(m_thread_list.GetMutex()); - // m_thread_list does have its own mutex, but we need to - // hold onto the mutex between the call to UpdateThreadList(...) - // and the os->UpdateThreadList(...) so it doesn't change on us + // m_thread_list does have its own mutex, but we need to hold onto the + // mutex between the call to UpdateThreadList(...) and the + // os->UpdateThreadList(...) so it doesn't change on us ThreadList &old_thread_list = m_thread_list; ThreadList real_thread_list(this); ThreadList new_thread_list(this); - // Always update the thread list with the protocol specific - // thread list, but only update if "true" is returned + // Always update the thread list with the protocol specific thread list, + // but only update if "true" is returned if (UpdateThreadList(m_thread_list_real, real_thread_list)) { // Don't call into the OperatingSystem to update the thread list if we - // are shutting down, since - // that may call back into the SBAPI's, requiring the API lock which is - // already held by whoever is - // shutting us down, causing a deadlock. + // are shutting down, since that may call back into the SBAPI's, + // requiring the API lock which is already held by whoever is shutting + // us down, causing a deadlock. OperatingSystem *os = GetOperatingSystem(); if (os && !m_destroy_in_process) { // Clear any old backing threads where memory threads might have been @@ -1472,12 +1461,9 @@ old_thread_list.GetThreadAtIndex(i, false)->ClearBackingThread(); // Turn off dynamic types to ensure we don't run any expressions. - // Objective C - // can run an expression to determine if a SBValue is a dynamic type - // or not - // and we need to avoid this. OperatingSystem plug-ins can't run - // expressions - // that require running code... + // Objective C can run an expression to determine if a SBValue is a + // dynamic type or not and we need to avoid this. OperatingSystem + // plug-ins can't run expressions that require running code... Target &target = GetTarget(); const lldb::DynamicValueType saved_prefer_dynamic = @@ -1586,9 +1572,9 @@ const StateType old_state = m_public_state.GetValue(); m_public_state.SetValue(new_state); - // On the transition from Run to Stopped, we unlock the writer end of the - // run lock. The lock gets locked in Resume, which is the public API - // to tell the program to run. + // On the transition from Run to Stopped, we unlock the writer end of the run + // lock. The lock gets locked in Resume, which is the public API to tell the + // program to run. if (!StateChangedIsExternallyHijacked()) { if (new_state == eStateDetached) { if (log) @@ -1701,17 +1687,16 @@ new Event(eBroadcastBitStateChanged, new ProcessEventData(shared_from_this(), new_state))); if (StateIsStoppedState(new_state, false)) { - // Note, this currently assumes that all threads in the list - // stop when the process stops. In the future we will want to - // support a debugging model where some threads continue to run - // while others are stopped. When that happens we will either need - // a way for the thread list to identify which threads are stopping - // or create a special thread list containing only threads which - // actually stopped. + // Note, this currently assumes that all threads in the list stop when + // the process stops. In the future we will want to support a debugging + // model where some threads continue to run while others are stopped. + // When that happens we will either need a way for the thread list to + // identify which threads are stopping or create a special thread list + // containing only threads which actually stopped. // - // The process plugin is responsible for managing the actual - // behavior of the threads and should have stopped any threads - // that are going to stop before we get here. + // The process plugin is responsible for managing the actual behavior of + // the threads and should have stopped any threads that are going to stop + // before we get here. m_thread_list.DidStop(); m_mod_id.BumpStopID(); @@ -1884,8 +1869,8 @@ break; } - // Reset the IsIndirect flag here, in case the location changes from - // pointing to a indirect symbol to a regular symbol. + // Reset the IsIndirect flag here, in case the location changes from pointing + // to a indirect symbol to a regular symbol. owner->SetIsIndirect(false); if (owner->ShouldResolveIndirectFunctions()) { @@ -1915,8 +1900,7 @@ BreakpointSiteSP bp_site_sp; // Look up this breakpoint site. If it exists, then add this new owner, - // otherwise - // create a new breakpoint site and add it. + // otherwise create a new breakpoint site and add it. bp_site_sp = m_breakpoint_site_list.FindByAddress(load_addr); @@ -2164,7 +2148,8 @@ return error; } -// Uncomment to verify memory caching works after making changes to caching code +// Uncomment to verify memory caching works after making changes to caching +// code //#define VERIFY_MEMORY_READS size_t Process::ReadMemory(addr_t addr, void *buf, size_t size, Status &error) { @@ -2218,8 +2203,8 @@ if (length == 0) break; out_str.append(buf, length); - // If we got "length - 1" bytes, we didn't get the whole C string, we - // need to read some more characters + // If we got "length - 1" bytes, we didn't get the whole C string, we need + // to read some more characters if (length == sizeof(buf) - 1) curr_addr += length; else @@ -2232,7 +2217,8 @@ Status &error, size_t type_width) { size_t total_bytes_read = 0; if (dst && max_bytes && type_width && max_bytes >= type_width) { - // Ensure a null terminator independent of the number of bytes that is read. + // Ensure a null terminator independent of the number of bytes that is + // read. memset(dst, 0, max_bytes); size_t bytes_left = max_bytes - type_width; @@ -2279,8 +2265,7 @@ } // Deprecated in favor of ReadStringFromMemory which has wchar support and -// correct code to find -// null terminators. +// correct code to find null terminators. size_t Process::ReadCStringFromMemory(addr_t addr, char *dst, size_t dst_max_len, Status &result_error) { @@ -2454,16 +2439,16 @@ // Check for bytes before this breakpoint const addr_t curr_addr = addr + bytes_written; if (intersect_addr > curr_addr) { - // There are some bytes before this breakpoint that we need to - // just write to memory + // There are some bytes before this breakpoint that we need to just + // write to memory size_t curr_size = intersect_addr - curr_addr; size_t curr_bytes_written = WriteMemoryPrivate( curr_addr, ubuf + bytes_written, curr_size, error); bytes_written += curr_bytes_written; if (curr_bytes_written != curr_size) { - // We weren't able to write all of the requested bytes, we - // are done looping and will return the number of bytes that - // we have written so far. + // We weren't able to write all of the requested bytes, we are + // done looping and will return the number of bytes that we have + // written so far. if (error.Success()) error.SetErrorToGenericError(); } @@ -2697,8 +2682,8 @@ Process::WaitForProcessStopPrivate(EventSP &event_sp, const Timeout &timeout) { StateType state; - // Now wait for the process to launch and return control to us, and then - // call DidLaunch: + // Now wait for the process to launch and return control to us, and then call + // DidLaunch: while (true) { event_sp.reset(); state = GetStateChangedEventsPrivate(event_sp, timeout); @@ -2779,8 +2764,8 @@ StateType state = WaitForProcessStopPrivate(event_sp, seconds(10)); if (state == eStateInvalid || !event_sp) { - // We were able to launch the process, but we failed to - // catch the initial stop. + // We were able to launch the process, but we failed to catch the + // initial stop. error.SetErrorString("failed to catch stop after launch"); SetExitStatus(0, "failed to catch stop after launch"); Destroy(false); @@ -2800,18 +2785,15 @@ if (!m_os_ap) LoadOperatingSystemPlugin(false); - // We successfully launched the process and stopped, - // now it the right time to set up signal filters before resuming. + // We successfully launched the process and stopped, now it the + // right time to set up signal filters before resuming. UpdateAutomaticSignalFiltering(); // Note, the stop event was consumed above, but not handled. This - // was done - // to give DidLaunch a chance to run. The target is either stopped - // or crashed. - // Directly set the state. This is done to prevent a stop message - // with a bunch - // of spurious output on thread status, as well as not pop a - // ProcessIOHandler. + // was done to give DidLaunch a chance to run. The target is either + // stopped or crashed. Directly set the state. This is done to + // prevent a stop message with a bunch of spurious output on thread + // status, as well as not pop a ProcessIOHandler. SetPublicState(state, false); if (PrivateStateThreadIsValid()) @@ -2820,15 +2802,13 @@ StartPrivateStateThread(); // Target was stopped at entry as was intended. Need to notify the - // listeners - // about it. + // listeners about it. if (state == eStateStopped && launch_info.GetFlags().Test(eLaunchFlagStopAtEntry)) HandlePrivateEvent(event_sp); } else if (state == eStateExited) { // We exited while trying to launch somehow. Don't call DidLaunch - // as that's - // not likely to work, and return an invalid pid. + // as that's not likely to work, and return an invalid pid. HandlePrivateEvent(event_sp); } } @@ -2867,8 +2847,7 @@ LoadOperatingSystemPlugin(false); // We successfully loaded a core file, now pretend we stopped so we can - // show all of the threads in the core file and explore the crashed - // state. + // show all of the threads in the core file and explore the crashed state. SetPrivateState(eStateStopped); // Wait for a stopped event since we just posted one above... @@ -2944,8 +2923,8 @@ // During attach, prior to sending the eStateStopped event, // lldb_private::Process subclasses must set the new process ID. assert(m_process->GetID() != LLDB_INVALID_PROCESS_ID); - // We don't want these events to be reported, so go set the ShouldReportStop - // here: + // We don't want these events to be reported, so go set the + // ShouldReportStop here: m_process->GetThreadList().SetShouldReportStop(eVoteNo); if (m_exec_count > 0) { @@ -3139,8 +3118,8 @@ } // We just attached. If we have a platform, ask it for the process - // architecture, and if it isn't - // the same as the one we've already set, switch architectures. + // architecture, and if it isn't the same as the one we've already set, + // switch architectures. PlatformSP platform_sp(GetTarget().GetPlatform()); assert(platform_sp); if (platform_sp) { @@ -3277,21 +3256,20 @@ m_mod_id.GetStopID(), StateAsCString(m_public_state.GetValue()), StateAsCString(m_private_state.GetValue())); - // If signals handing status changed we might want to update - // our signal filters before resuming. + // If signals handing status changed we might want to update our signal + // filters before resuming. UpdateAutomaticSignalFiltering(); Status error(WillResume()); // Tell the process it is about to resume before the thread list if (error.Success()) { - // Now let the thread list know we are about to resume so it - // can let all of our threads know that they are about to be - // resumed. Threads will each be called with - // Thread::WillResume(StateType) where StateType contains the state - // that they are supposed to have when the process is resumed - // (suspended/running/stepping). Threads should also check - // their resume signal in lldb::Thread::GetResumeSignal() - // to see if they are supposed to start back up with a signal. + // Now let the thread list know we are about to resume so it can let all of + // our threads know that they are about to be resumed. Threads will each be + // called with Thread::WillResume(StateType) where StateType contains the + // state that they are supposed to have when the process is resumed + // (suspended/running/stepping). Threads should also check their resume + // signal in lldb::Thread::GetResumeSignal() to see if they are supposed to + // start back up with a signal. if (m_thread_list.WillResume()) { // Last thing, do the PreResumeActions. if (!RunPreResumeActions()) { @@ -3308,11 +3286,10 @@ } } } else { - // Somebody wanted to run without running (e.g. we were faking a step from - // one frame of a set of inlined - // frames that share the same PC to another.) So generate a continue & a - // stopped event, - // and let the world handle them. + // Somebody wanted to run without running (e.g. we were faking a step + // from one frame of a set of inlined frames that share the same PC to + // another.) So generate a continue & a stopped event, and let the world + // handle them. if (log) log->Printf( "Process::PrivateResume() asked to simulate a start & stop."); @@ -3330,9 +3307,8 @@ if (!StateIsRunningState(m_public_state.GetValue())) return Status("Process is not running."); - // Don't clear the m_clear_thread_plans_on_stop, only set it to true if - // in case it was already set and some thread plan logic calls halt on its - // own. + // Don't clear the m_clear_thread_plans_on_stop, only set it to true if in + // case it was already set and some thread plan logic calls halt on its own. m_clear_thread_plans_on_stop |= clear_thread_plans; ListenerSP halt_listener_sp( @@ -3344,8 +3320,8 @@ SendAsyncInterrupt(); if (m_public_state.GetValue() == eStateAttaching) { - // Don't hijack and eat the eStateExited as the code that was doing - // the attach will be waiting for this event... + // Don't hijack and eat the eStateExited as the code that was doing the + // attach will be waiting for this event... RestoreProcessEvents(); SetExitStatus(SIGKILL, "Cancelled async attach."); Destroy(false); @@ -3371,8 +3347,8 @@ Status error; // Check both the public & private states here. If we're hung evaluating an - // expression, for instance, then - // the public state will be stopped, but we still need to interrupt. + // expression, for instance, then the public state will be stopped, but we + // still need to interrupt. if (m_public_state.GetValue() == eStateRunning || m_private_state.GetValue() == eStateRunning) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -3392,10 +3368,9 @@ RestoreProcessEvents(); // If the process exited while we were waiting for it to stop, put the - // exited event into - // the shared pointer passed in and return. Our caller doesn't need to do - // anything else, since - // they don't have a process anymore... + // exited event into the shared pointer passed in and return. Our caller + // doesn't need to do anything else, since they don't have a process + // anymore... if (state == eStateExited || m_private_state.GetValue() == eStateExited) { if (log) @@ -3410,9 +3385,8 @@ log->Printf("Process::%s() failed to stop, state is: %s", __FUNCTION__, StateAsCString(state)); // If we really couldn't stop the process then we should just error out - // here, but if the - // lower levels just bobbled sending the event and we really are stopped, - // then continue on. + // here, but if the lower levels just bobbled sending the event and we + // really are stopped, then continue on. StateType private_state = m_private_state.GetValue(); if (private_state != eStateStopped) { return Status( @@ -3460,20 +3434,18 @@ } m_destroy_in_process = false; - // If we exited when we were waiting for a process to stop, then - // forward the event here so we don't lose the event + // If we exited when we were waiting for a process to stop, then forward the + // event here so we don't lose the event if (exit_event_sp) { - // Directly broadcast our exited event because we shut down our - // private state thread above + // Directly broadcast our exited event because we shut down our private + // state thread above BroadcastEvent(exit_event_sp); } // If we have been interrupted (to kill us) in the middle of running, we may - // not end up propagating - // the last events through the event system, in which case we might strand the - // write lock. Unlock - // it here so when we do to tear down the process we don't get an error - // destroying the lock. + // not end up propagating the last events through the event system, in which + // case we might strand the write lock. Unlock it here so when we do to tear + // down the process we don't get an error destroying the lock. m_public_run_lock.SetStopped(); return error; @@ -3482,9 +3454,8 @@ Status Process::Destroy(bool force_kill) { // Tell ourselves we are in the process of destroying the process, so that we - // don't do any unnecessary work - // that might hinder the destruction. Remember to set this back to false when - // we are done. That way if the attempt + // don't do any unnecessary work that might hinder the destruction. Remember + // to set this back to false when we are done. That way if the attempt // failed and the process stays around for some reason it won't be in a // confused state. @@ -3507,12 +3478,11 @@ } if (m_public_state.GetValue() != eStateRunning) { - // Ditch all thread plans, and remove all our breakpoints: in case we have - // to restart the target to - // kill it, we don't want it hitting a breakpoint... - // Only do this if we've stopped, however, since if we didn't manage to - // halt it above, then - // we're not going to have much luck doing this now. + // Ditch all thread plans, and remove all our breakpoints: in case we + // have to restart the target to kill it, we don't want it hitting a + // breakpoint... Only do this if we've stopped, however, since if we + // didn't manage to halt it above, then we're not going to have much luck + // doing this now. m_thread_list.DiscardThreadPlans(); DisableAllBreakpointSites(); } @@ -3532,20 +3502,18 @@ m_process_input_reader.reset(); } - // If we exited when we were waiting for a process to stop, then - // forward the event here so we don't lose the event + // If we exited when we were waiting for a process to stop, then forward + // the event here so we don't lose the event if (exit_event_sp) { - // Directly broadcast our exited event because we shut down our - // private state thread above + // Directly broadcast our exited event because we shut down our private + // state thread above BroadcastEvent(exit_event_sp); } - // If we have been interrupted (to kill us) in the middle of running, we may - // not end up propagating - // the last events through the event system, in which case we might strand - // the write lock. Unlock - // it here so when we do to tear down the process we don't get an error - // destroying the lock. + // If we have been interrupted (to kill us) in the middle of running, we + // may not end up propagating the last events through the event system, in + // which case we might strand the write lock. Unlock it here so when we do + // to tear down the process we don't get an error destroying the lock. m_public_run_lock.SetStopped(); } @@ -3612,11 +3580,11 @@ break; case eStateRunning: case eStateStepping: - // If we've started the target running, we handle the cases where we - // are already running and where there is a transition from stopped to - // running differently. - // running -> running: Automatically suppress extra running events - // stopped -> running: Report except when there is one or more no votes + // If we've started the target running, we handle the cases where we are + // already running and where there is a transition from stopped to running + // differently. running -> running: Automatically suppress extra running + // events stopped -> running: Report except when there is one or more no + // votes // and no yes votes. SynchronouslyNotifyStateChanged(state); if (m_force_next_event_delivery) @@ -3630,11 +3598,10 @@ break; default: // TODO: make this work correctly. For now always report - // run if we aren't running so we don't miss any running - // events. If I run the lldb/test/thread/a.out file and - // break at main.cpp:58, run and hit the breakpoints on - // multiple threads, then somehow during the stepping over - // of all breakpoints no run gets reported. + // run if we aren't running so we don't miss any running events. If I + // run the lldb/test/thread/a.out file and break at main.cpp:58, run + // and hit the breakpoints on multiple threads, then somehow during the + // stepping over of all breakpoints no run gets reported. // This is a transition from stop to run. switch (m_thread_list.ShouldReportRun(event_ptr)) { @@ -3653,11 +3620,10 @@ case eStateStopped: case eStateCrashed: case eStateSuspended: - // We've stopped. First see if we're going to restart the target. - // If we are going to stop, then we always broadcast the event. - // If we aren't going to stop, let the thread plans decide if we're going to - // report this event. - // If no thread has an opinion, we don't report it. + // We've stopped. First see if we're going to restart the target. If we + // are going to stop, then we always broadcast the event. If we aren't + // going to stop, let the thread plans decide if we're going to report this + // event. If no thread has an opinion, we don't report it. m_stdio_communication.SynchronizeWithReadThread(); RefreshStateAfterStop(); @@ -3667,8 +3633,7 @@ "interrupt, state: %s", static_cast(event_ptr), StateAsCString(state)); // Even though we know we are going to stop, we should let the threads - // have a look at the stop, - // so they can properly set their state. + // have a look at the stop, so they can properly set their state. m_thread_list.ShouldStop(event_ptr); return_value = true; } else { @@ -3676,10 +3641,8 @@ 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. + // 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); @@ -3722,16 +3685,13 @@ m_force_next_event_delivery = false; // We do some coalescing of events (for instance two consecutive running - // events get coalesced.) - // But we only coalesce against events we actually broadcast. So we use - // m_last_broadcast_state - // to track that. NB - you can't use "m_public_state.GetValue()" for that - // purpose, as was originally done, - // 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. + // events get coalesced.) But we only coalesce against events we actually + // broadcast. So we use m_last_broadcast_state to track that. NB - you + // can't use "m_public_state.GetValue()" for that purpose, as was originally + // done, 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; @@ -3757,8 +3717,8 @@ if (!is_secondary_thread && already_running) return true; - // Create a thread that watches our internal state and controls which - // events make it to clients (into the DCProcess event queue). + // Create a thread that watches our internal state and controls which events + // make it to clients (into the DCProcess event queue). char thread_name[1024]; uint32_t max_len = llvm::get_max_thread_name_length(); if (max_len > 0 && max_len <= 30) { @@ -3823,10 +3783,10 @@ // Signal the private state thread if (m_private_state_thread.IsJoinable()) { // Broadcast the event. - // It is important to do this outside of the if below, because - // it's possible that the thread state is invalid but that the - // thread is waiting on a control event instead of simply being - // on its way out (this should not happen, but it apparently can). + // It is important to do this outside of the if below, because it's + // possible that the thread state is invalid but that the thread is waiting + // on a control event instead of simply being on its way out (this should + // not happen, but it apparently can). if (log) log->Printf("Sending control event of type: %d.", signal); std::shared_ptr event_receipt_sp(new EventDataReceipt()); @@ -3838,13 +3798,13 @@ if (PrivateStateThreadIsValid()) { while (!receipt_received) { bool timed_out = false; - // Check for a receipt for 2 seconds and then check if the private state - // thread is still around. + // Check for a receipt for 2 seconds and then check if the private + // state thread is still around. receipt_received = event_receipt_sp->WaitForEventReceived( std::chrono::seconds(2), &timed_out); if (!receipt_received) { - // Check if the private state thread is still around. If it isn't then - // we are done waiting + // Check if the private state thread is still around. If it isn't + // then we are done waiting if (!PrivateStateThreadIsValid()) break; // Private state thread exited or is exiting, we are done } @@ -3894,9 +3854,9 @@ break; case NextEventAction::eEventActionExit: - // Handle Exiting Here. If we already got an exited event, - // we should just propagate it. Otherwise, swallow this event, - // and set our state to exit so the next event will kill us. + // Handle Exiting Here. If we already got an exited event, we should + // just propagate it. Otherwise, swallow this event, and set our state + // to exit so the next event will kill us. if (new_state != eStateExited) { // FIXME: should cons up an exited event, and discard this one. SetExitStatus(0, m_next_event_action_ap->GetExitString()); @@ -3922,9 +3882,9 @@ } Process::ProcessEventData::SetUpdateStateOnRemoval(event_sp.get()); if (StateIsRunningState(new_state)) { - // Only push the input handler if we aren't fowarding events, - // as this means the curses GUI is in use... - // Or don't push it if we are launching since it will come up stopped. + // Only push the input handler if we aren't fowarding events, as this + // means the curses GUI is in use... Or don't push it if we are launching + // since it will come up stopped. if (!GetTarget().GetDebugger().IsForwardingEvents() && new_state != eStateLaunching && new_state != eStateAttaching) { PushProcessIOHandler(); @@ -3936,27 +3896,26 @@ } } else if (StateIsStoppedState(new_state, false)) { if (!Process::ProcessEventData::GetRestartedFromEvent(event_sp.get())) { - // If the lldb_private::Debugger is handling the events, we don't - // want to pop the process IOHandler here, we want to do it when - // we receive the stopped event so we can carefully control when - // the process IOHandler is popped because when we stop we want to - // display some text stating how and why we stopped, then maybe some - // process/thread/frame info, and then we want the "(lldb) " prompt - // to show up. If we pop the process IOHandler here, then we will - // cause the command interpreter to become the top IOHandler after - // the process pops off and it will update its prompt right away... - // See the Debugger.cpp file where it calls the function as + // If the lldb_private::Debugger is handling the events, we don't want + // to pop the process IOHandler here, we want to do it when we receive + // the stopped event so we can carefully control when the process + // IOHandler is popped because when we stop we want to display some + // text stating how and why we stopped, then maybe some + // process/thread/frame info, and then we want the "(lldb) " prompt to + // show up. If we pop the process IOHandler here, then we will cause + // the command interpreter to become the top IOHandler after the + // process pops off and it will update its prompt right away... See the + // Debugger.cpp file where it calls the function as // "process_sp->PopProcessIOHandler()" to see where I am talking about. // Otherwise we end up getting overlapping "(lldb) " prompts and // garbled output. // // If we aren't handling the events in the debugger (which is indicated - // by "m_target.GetDebugger().IsHandlingEvents()" returning false) or we - // are hijacked, then we always pop the process IO handler manually. + // by "m_target.GetDebugger().IsHandlingEvents()" returning false) or + // we are hijacked, then we always pop the process IO handler manually. // Hijacking happens when the internal process state thread is running - // thread plans, or when commands want to run in synchronous mode - // and they call "process->WaitForProcessToStop()". An example of - // something + // thread plans, or when commands want to run in synchronous mode and + // they call "process->WaitForProcessToStop()". An example of something // that will hijack the events is a simple expression: // // (lldb) expr (int)puts("hello") @@ -4059,23 +4018,19 @@ ") failed to halt the process: %s", __FUNCTION__, static_cast(this), GetID(), error.AsCString()); - // Halt should generate a stopped event. Make a note of the fact that we - // were - // doing the interrupt, so we can set the interrupted flag after we - // receive the - // event. We deliberately set this to true even if HaltPrivate failed, - // so that we - // can interrupt on the next natural stop. + // Halt should generate a stopped event. Make a note of the fact that + // we were doing the interrupt, so we can set the interrupted flag + // after we receive the event. We deliberately set this to true even if + // HaltPrivate failed, so that we can interrupt on the next natural + // stop. interrupt_requested = true; } else { // This can happen when someone (e.g. Process::Halt) sees that we are - // running and - // sends an interrupt request, but the process actually stops before we - // receive - // it. In that case, we can just ignore the request. We use - // m_last_broadcast_state, because the Stopped event may not have been - // popped of - // the event queue yet, which is when the public state gets updated. + // running and sends an interrupt request, but the process actually + // stops before we receive it. In that case, we can just ignore the + // request. We use m_last_broadcast_state, because the Stopped event + // may not have been popped of the event queue yet, which is when the + // public state gets updated. if (log) log->Printf( "Process::%s ignoring interrupt as we have already stopped.", @@ -4097,8 +4052,7 @@ if (interrupt_requested) { if (StateIsStoppedState(internal_state, true)) { // We requested the interrupt, so mark this as such in the stop event - // so - // clients can tell an interrupted process from a natural stop + // so clients can tell an interrupted process from a natural stop ProcessEventData::SetInterruptedInEvent(event_sp.get(), true); interrupt_requested = false; } else if (log) { @@ -4129,10 +4083,8 @@ __FUNCTION__, static_cast(this), GetID()); // If we are a secondary thread, then the primary thread we are working for - // will have already - // acquired the public_run_lock, and isn't done with what it was doing yet, so - // don't - // try to change it on the way out. + // will have already acquired the public_run_lock, and isn't done with what + // it was doing yet, so don't try to change it on the way out. if (!is_secondary_thread) m_public_run_lock.SetStopped(); return NULL; @@ -4172,14 +4124,12 @@ return; // This function gets called twice for each event, once when the event gets - // pulled - // off of the private process event queue, and then any number of times, first - // when it gets pulled off of - // the public event queue, then other times when we're pretending that this is - // where we stopped at the - // end of expression evaluation. m_update_state is used to distinguish these - // three cases; it is 0 when we're just pulling it off for private handling, - // and > 1 for expression evaluation, and we don't want to do the breakpoint + // pulled off of the private process event queue, and then any number of + // times, first when it gets pulled off of the public event queue, then other + // times when we're pretending that this is where we stopped at the end of + // expression evaluation. m_update_state is used to distinguish these three + // cases; it is 0 when we're just pulling it off for private handling, and > + // 1 for expression evaluation, and we don't want to do the breakpoint // command handling then. if (m_update_state != 1) return; @@ -4188,16 +4138,15 @@ m_state, Process::ProcessEventData::GetRestartedFromEvent(event_ptr)); if (m_state == eStateStopped && !m_restarted) { - // Let process subclasses know we are about to do a public stop and - // do anything they might need to in order to speed up register and - // memory accesses. + // Let process subclasses know we are about to do a public stop and do + // anything they might need to in order to speed up register and memory + // accesses. process_sp->WillPublicStop(); } // If this is a halt event, even if the halt stopped with some reason other - // than a plain interrupt (e.g. we had - // already stopped for a breakpoint when the halt request came through) don't - // do the StopInfo actions, as they may + // than a plain interrupt (e.g. we had already stopped for a breakpoint when + // the halt request came through) don't do the StopInfo actions, as they may // end up restarting the process. if (m_interrupted) return; @@ -4209,37 +4158,32 @@ uint32_t idx; // The actions might change one of the thread's stop_info's opinions about - // whether we should - // stop the process, so we need to query that as we go. + // whether we should stop the process, so we need to query that as we go. // One other complication here, is that we try to catch any case where the - // target has run (except for expressions) - // and immediately exit, but if we get that wrong (which is possible) then - // the thread list might have changed, and - // that would cause our iteration here to crash. We could make a copy of - // the thread list, but we'd really like - // to also know if it has changed at all, so we make up a vector of the - // thread ID's and check what we get back - // against this list & bag out if anything differs. + // target has run (except for expressions) and immediately exit, but if we + // get that wrong (which is possible) then the thread list might have + // changed, and that would cause our iteration here to crash. We could + // make a copy of the thread list, but we'd really like to also know if it + // has changed at all, so we make up a vector of the thread ID's and check + // what we get back against this list & bag out if anything differs. std::vector thread_index_array(num_threads); for (idx = 0; idx < num_threads; ++idx) thread_index_array[idx] = curr_thread_list.GetThreadAtIndex(idx)->GetIndexID(); // Use this to track whether we should continue from here. We will only - // continue the target running if - // no thread says we should stop. Of course if some thread's PerformAction - // actually sets the target running, - // then it doesn't matter what the other threads say... + // continue the target running if no thread says we should stop. Of course + // if some thread's PerformAction actually sets the target running, then it + // doesn't matter what the other threads say... bool still_should_stop = false; // Sometimes - for instance if we have a bug in the stub we are talking to, - // we stop but no thread has a - // valid stop reason. In that case we should just stop, because we have no - // way of telling what the right - // thing to do is, and it's better to let the user decide than continue - // behind their backs. + // we stop but no thread has a valid stop reason. In that case we should + // just stop, because we have no way of telling what the right thing to do + // is, and it's better to let the user decide than continue behind their + // backs. bool does_anybody_have_an_opinion = false; @@ -4276,13 +4220,11 @@ stop_info_sp->GetOverriddenShouldStopValue(); } else { stop_info_sp->PerformAction(event_ptr); - // The stop action might restart the target. If it does, then we want - // to mark that in the - // event so that whoever is receiving it will know to wait for the - // running event and reflect - // that state appropriately. - // We also need to stop processing actions, since they aren't - // expecting the target to be running. + // The stop action might restart the target. If it does, then we + // want to mark that in the event so that whoever is receiving it + // will know to wait for the running event and reflect that state + // appropriately. We also need to stop processing actions, since they + // aren't expecting the target to be running. // FIXME: we might have run. if (stop_info_sp->HasTargetRunSinceMe()) { @@ -4302,12 +4244,12 @@ if (!still_should_stop && does_anybody_have_an_opinion) { // We've been asked to continue, so do that here. SetRestarted(true); - // Use the public resume method here, since this is just - // extending a public resume. + // Use the public resume method here, since this is just extending a + // public resume. process_sp->PrivateResume(); } else { - // If we didn't restart, run the Stop Hooks here: - // They might also restart the target, so watch for that. + // If we didn't restart, run the Stop Hooks here: They might also + // restart the target, so watch for that. process_sp->GetTarget().RunStopHooks(); if (process_sp->GetPrivateState() == eStateRunning) SetRestarted(true); @@ -4579,9 +4521,8 @@ ~IOHandlerProcessSTDIO() override = default; - // Each IOHandler gets to run until it is done. It should read data - // from the "in" and place output into "out" and "err and return - // when done. + // Each IOHandler gets to run until it is done. It should read data from the + // "in" and place output into "out" and "err and return when done. void Run() override { if (!m_read_file.IsValid() || !m_write_file.IsValid() || !m_pipe.CanRead() || !m_pipe.CanWrite()) { @@ -4645,9 +4586,8 @@ void Cancel() override { SetIsDone(true); // Only write to our pipe to cancel if we are in - // IOHandlerProcessSTDIO::Run(). - // We can end up with a python command that is being run from the command - // interpreter: + // IOHandlerProcessSTDIO::Run(). We can end up with a python command that + // is being run from the command interpreter: // // (lldb) step_process_thousands_of_times // @@ -4664,12 +4604,11 @@ } bool Interrupt() override { - // Do only things that are safe to do in an interrupt context (like in - // a SIGINT handler), like write 1 byte to a file descriptor. This will + // Do only things that are safe to do in an interrupt context (like in a + // SIGINT handler), like write 1 byte to a file descriptor. This will // interrupt the IOHandlerProcessSTDIO::Run() and we can look at the byte // that was written to the pipe and then call - // m_process->SendAsyncInterrupt() - // from a much safer location in code. + // m_process->SendAsyncInterrupt() from a much safer location in code. if (m_active) { char ch = 'i'; // Send 'i' for interrupt size_t bytes_written = 0; @@ -4677,16 +4616,13 @@ return result.Success(); } else { // This IOHandler might be pushed on the stack, but not being run - // currently - // so do the right thing if we aren't actively watching for STDIN by - // sending - // the interrupt to the process. Otherwise the write to the pipe above - // would - // do nothing. This can happen when the command interpreter is running and - // gets a "expression ...". It will be on the IOHandler thread and sending - // the input is complete to the delegate which will cause the expression - // to - // run, which will push the process IO handler, but not run it. + // currently so do the right thing if we aren't actively watching for + // STDIN by sending the interrupt to the process. Otherwise the write to + // the pipe above would do nothing. This can happen when the command + // interpreter is running and gets a "expression ...". It will be on the + // IOHandler thread and sending the input is complete to the delegate + // which will cause the expression to run, which will push the process IO + // handler, but not run it. if (StateIsRunningState(m_process->GetState())) { m_process->SendAsyncInterrupt(); @@ -4761,12 +4697,10 @@ void Process::SettingsTerminate() { Thread::SettingsTerminate(); } namespace { -// RestorePlanState is used to record the "is private", "is master" and "okay to -// discard" fields of -// the plan we are running, and reset it on Clean or on destruction. -// It will only reset the state once, so you can call Clean and then monkey with -// the state and it -// won't get reset on you again. +// RestorePlanState is used to record the "is private", "is master" and "okay +// to discard" fields of the plan we are running, and reset it on Clean or on +// destruction. It will only reset the state once, so you can call Clean and +// then monkey with the state and it won't get reset on you again. class RestorePlanState { public: @@ -4822,8 +4756,8 @@ static Timeout GetExpressionTimeout(const EvaluateExpressionOptions &options, bool before_first_timeout) { - // If we are going to run all threads the whole time, or if we are only - // going to run one thread, we can just return the overall timeout. + // If we are going to run all threads the whole time, or if we are only going + // to run one thread, we can just return the overall timeout. if (!options.GetStopOthers() || !options.GetTryAllThreads()) return options.GetTimeout(); @@ -4860,7 +4794,8 @@ if (!options.DoesIgnoreBreakpoints()) { // Restore the plan state and then force Private to false. We are going // to stop because of this plan so we need it to become a public plan or - // it won't report correctly when we continue to its termination later on. + // it won't report correctly when we continue to its termination later + // on. restorer.Clean(); thread_plan_sp->SetPrivate(false); event_to_broadcast_sp = event_sp; @@ -4915,23 +4850,20 @@ } // We need to change some of the thread plan attributes for the thread plan - // runner. This will restore them - // when we are done: + // runner. This will restore them when we are done: RestorePlanState thread_plan_restorer(thread_plan_sp); - // 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. + // 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. thread_plan_sp->SetPrivate(false); // The plans run with RunThreadPlan also need to be terminal master plans or - // when they are done we will end - // up asking the plan above us whether we should stop, which may give the - // wrong answer. + // when they are done we will end up asking the plan above us whether we + // should stop, which may give the wrong answer. thread_plan_sp->SetIsMasterPlan(true); thread_plan_sp->SetOkayToDiscard(false); @@ -4958,8 +4890,8 @@ } } - // Make sure the timeout values make sense. The one thread timeout needs to be - // smaller than the overall timeout. + // Make sure the timeout values make sense. The one thread timeout needs to + // be smaller than the overall timeout. if (options.GetOneThreadTimeout() && options.GetTimeout() && *options.GetTimeout() < *options.GetOneThreadTimeout()) { diagnostic_manager.PutString(eDiagnosticSeverityError, @@ -4971,8 +4903,8 @@ 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. + // We don't want to do that either, so we should arrange to reset them as + // well. lldb::ThreadSP selected_thread_sp = GetThreadList().GetSelectedThread(); @@ -4993,11 +4925,10 @@ LIBLLDB_LOG_PROCESS)); if (m_private_state_thread.EqualsThread(Host::GetCurrentThread())) { // Yikes, we are running on the private state thread! So we can't wait for - // public events on this thread, since - // we are the thread that is generating public events. - // The simplest thing to do is to spin up a temporary thread to handle - // private state thread events while - // we are fielding public events here. + // public events on this thread, since we are the thread that is generating + // public events. The simplest thing to do is to spin up a temporary thread + // to handle private state thread events while 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."); @@ -5005,15 +4936,12 @@ backup_private_state_thread = m_private_state_thread; // One other bit of business: we want to run just this thread plan and - // anything it pushes, and then stop, - // returning control here. - // But in the normal course of things, the plan above us on the stack would - // be given a shot at the stop - // event before deciding to stop, and we don't want that. So we insert a - // "stopper" base plan on the stack - // before the plan we want to run. Since base plans always stop and return - // control to the user, that will - // do just what we want. + // anything it pushes, and then stop, returning control here. But in the + // normal course of things, the plan above us on the stack would be given a + // shot at the stop event before deciding to stop, and we don't want that. + // So we insert a "stopper" base plan on the stack before the plan we want + // to run. Since base plans always stop and return control to the user, + // that will do just what we want. stopper_base_plan_sp.reset(new ThreadPlanBase(*thread)); thread->QueueThreadPlan(stopper_base_plan_sp, false); // Have to make sure our public state is stopped, since otherwise the @@ -5029,15 +4957,13 @@ 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. - // Flush this thread so we will refetch the stacks and show the correct - // backtrace. + // In this case, we aren't actually going to run, we just want to stop + // right away. Flush this thread so we will refetch the stacks and show the + // correct backtrace. // FIXME: To make this prettier we should invent some stop reason for this, // but that // is only cosmetic, and this functionality is only of use to lldb - // developers who can - // live with not pretty... + // developers who can live with not pretty... thread->Flush(); return eExpressionStoppedForDebug; } @@ -5049,12 +4975,11 @@ { // This process event hijacker Hijacks the Public events and its destructor - // makes sure that the process events get - // restored on exit to the function. + // 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. + // exits during execution), then the event is put into + // event_to_broadcast_sp for rebroadcasting. ProcessEventHijacker run_thread_plan_hijacker(*this, listener_sp); @@ -5089,10 +5014,10 @@ options.GetStopOthers(), options.GetTryAllThreads(), before_first_timeout); - // 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. + // 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_sp->PeekAtNextEvent(); if (other_events != nullptr) { @@ -5103,32 +5028,29 @@ } // 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... + // 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. +// when we are done. So don't call return anywhere within it. #ifdef LLDB_RUN_THREAD_HALT_WITH_EVENT - // It's pretty much impossible to write test cases for things like: - // One thread timeout expires, I go to halt, but the process already stopped - // on the function call stop breakpoint. Turning on this define will make - // us not - // fetch the first event till after the halt. So if you run a quick - // function, it will have - // completed, and the completion event will be waiting, when you interrupt - // for halt. - // The expression evaluation should still succeed. + // It's pretty much impossible to write test cases for things like: One + // thread timeout expires, I go to halt, but the process already stopped on + // the function call stop breakpoint. Turning on this define will make us + // not fetch the first event till after the halt. So if you run a quick + // function, it will have completed, and the completion event will be + // waiting, when you interrupt for halt. The expression evaluation should + // still succeed. bool miss_first_event = true; #endif while (true) { - // We usually want to resume the process if we get to the top of the loop. - // The only exception is if we get two running events with no intervening - // stop, which can happen, we will just wait for then next stop event. + // We usually want to resume the process if we get to the top of the + // loop. The only exception is if we get two running events with no + // intervening stop, which can happen, we will just wait for then next + // stop event. if (log) log->Printf("Top of while loop: do_resume: %i handle_running_event: %i " "before_first_timeout: %i.", @@ -5187,9 +5109,8 @@ 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. + // should ever get a stopped & restarted event here. But if I do, + // the best thing is to Halt and then get out of here. const bool clear_thread_plans = false; const bool use_run_lock = false; Halt(clear_thread_plans, use_run_lock); @@ -5205,14 +5126,11 @@ if (log) log->PutCString("Process::RunThreadPlan(): resuming succeeded."); - // We need to call the function synchronously, so spin waiting for it to - // return. - // If we get interrupted while executing, we're going to lose our - // context, and - // won't be able to gather the result at this point. - // We set the timeout AFTER the resume, since the resume takes some time - // and we - // don't want to charge that to the timeout. + // We need to call the function synchronously, so spin waiting for it + // to return. If we get interrupted while executing, we're going to + // lose our context, and won't be able to gather the result at this + // point. We set the timeout AFTER the resume, since the resume takes + // some time and we don't want to charge that to the timeout. } else { if (log) log->PutCString("Process::RunThreadPlan(): waiting for next event."); @@ -5304,9 +5222,8 @@ case lldb::eStateRunning: // This shouldn't really happen, but sometimes we do get two - // running events without an - // intervening stop, and in that case we should just go back to - // waiting for the stop. + // running events without an intervening stop, and in that case + // we should just go back to waiting for the stop. do_resume = false; keep_going = true; handle_running_event = false; @@ -5341,10 +5258,10 @@ break; } } else { - // 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 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()) { @@ -5362,14 +5279,13 @@ } // 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. + // 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. + // 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; @@ -5418,8 +5334,8 @@ } // Between the time we initiated the Halt and the time we - // delivered it, the process could have - // already finished its job. Check that here: + // delivered it, the process could have already finished its + // job. Check that here: const bool handle_interrupts = false; if (auto result = HandleStoppedEvent( *thread, thread_plan_sp, thread_plan_restorer, event_sp, @@ -5482,8 +5398,8 @@ } } // END WAIT LOOP - // If we had to start up a temporary private state thread to run this thread - // plan, shut it down now. + // If we had to start up a temporary private state thread to run this + // thread plan, shut it down now. if (backup_private_state_thread.IsJoinable()) { StopPrivateStateThread(); Status error; @@ -5503,11 +5419,9 @@ log->PutString(s.GetString()); } // 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 - // 2) We hit a breakpoint, and ignore_breakpoints was true - // 3) We got some other error, and discard_on_error was true + // There are three cases where this could happen: 1) The execution + // successfully completed 2) We hit a breakpoint, and ignore_breakpoints + // was true 3) We got some other error, and discard_on_error was true bool should_unwind = (return_value == eExpressionInterrupted && options.DoesUnwindOnError()) || (return_value == eExpressionHitBreakpoint && @@ -5647,18 +5561,15 @@ } // 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. + // 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. thread = GetThreadList().FindThreadByIndexID(thread_idx_id, true).get(); if (thread) { 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. + // function calling may be done behind the user's back. if (selected_tid != LLDB_INVALID_THREAD_ID) { if (GetThreadList().SetSelectedThreadByIndexID(selected_tid) && @@ -5749,10 +5660,9 @@ size_t num_thread_infos_dumped = 0; // You can't hold the thread list lock while calling Thread::GetStatus. That - // very well might run code (e.g. if we need it - // to get return values or arguments.) For that to work the process has to be - // able to acquire it. So instead copy the thread - // ID's, and look them up one by one: + // very well might run code (e.g. if we need it to get return values or + // arguments.) For that to work the process has to be able to acquire it. + // So instead copy the thread ID's, and look them up one by one: uint32_t num_threads; std::vector thread_id_array; @@ -5865,12 +5775,12 @@ DoDidExec(); CompleteAttach(); // Flush the process (threads and all stack frames) after running - // CompleteAttach() - // in case the dynamic loader loaded things in new locations. + // CompleteAttach() in case the dynamic loader loaded things in new + // locations. Flush(); - // After we figure out what was loaded/unloaded in CompleteAttach, - // we need to let the target know so it can do any cleanup it needs to. + // After we figure out what was loaded/unloaded in CompleteAttach, we need to + // let the target know so it can do any cleanup it needs to. target.DidExec(); } @@ -5921,17 +5831,17 @@ runtime->ModulesDidLoad(module_list); } - // Let any language runtimes we have already created know - // about the modules that loaded. + // Let any language runtimes we have already created know about the modules + // that loaded. - // Iterate over a copy of this language runtime list in case - // the language runtime ModulesDidLoad somehow causes the language - // riuntime to be unloaded. + // Iterate over a copy of this language runtime list in case the language + // runtime ModulesDidLoad somehow causes the language riuntime to be + // unloaded. LanguageRuntimeCollection language_runtimes(m_language_runtimes); for (const auto &pair : language_runtimes) { - // We must check language_runtime_sp to make sure it is not - // nullptr as we might cache the fact that we didn't have a - // language runtime for a language. + // We must check language_runtime_sp to make sure it is not nullptr as we + // might cache the fact that we didn't have a language runtime for a + // language. LanguageRuntimeSP language_runtime_sp = pair.second; if (language_runtime_sp) language_runtime_sp->ModulesDidLoad(module_list); @@ -6131,9 +6041,9 @@ Status Process::ConfigureStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp) { - // If you get this, the Process-derived class needs to implement a method - // to enable an already-reported asynchronous structured data feature. - // See ProcessGDBRemote for an example implementation over gdb-remote. + // If you get this, the Process-derived class needs to implement a method to + // enable an already-reported asynchronous structured data feature. See + // ProcessGDBRemote for an example implementation over gdb-remote. return Status("unimplemented"); } @@ -6175,9 +6085,9 @@ return true; }); - // For each StructuredDataPlugin, if the plugin handles any of the - // types in the supported_type_names, map that type name to that plugin. - // Stop when we've consumed all the type names. + // For each StructuredDataPlugin, if the plugin handles any of the types in + // the supported_type_names, map that type name to that plugin. Stop when + // we've consumed all the type names. // FIXME: should we return an error if there are type names nobody // supports? for (uint32_t plugin_index = 0; !const_type_names.empty(); plugin_index++) { @@ -6190,13 +6100,12 @@ // Create the plugin. StructuredDataPluginSP plugin_sp = (*create_instance)(*this); if (!plugin_sp) { - // This plugin doesn't think it can work with the process. - // Move on to the next. + // This plugin doesn't think it can work with the process. Move on to the + // next. continue; } - // For any of the remaining type names, map any that this plugin - // supports. + // For any of the remaining type names, map any that this plugin supports. std::vector names_to_remove; for (auto &type_name : const_type_names) { if (plugin_sp->SupportsStructuredDataType(type_name)) { @@ -6223,8 +6132,8 @@ if (!object_sp) return false; - // The contract is this must be a dictionary, so we can look up the - // routing key via the top-level 'type' string value within the dictionary. + // The contract is this must be a dictionary, so we can look up the routing + // key via the top-level 'type' string value within the dictionary. StructuredData::Dictionary *dictionary = object_sp->GetAsDictionary(); if (!dictionary) return false; Index: lldb/trunk/source/Target/ProcessInfo.cpp =================================================================== --- lldb/trunk/source/Target/ProcessInfo.cpp +++ lldb/trunk/source/Target/ProcessInfo.cpp @@ -93,9 +93,9 @@ if (first_arg_is_executable) { const char *first_arg = m_arguments.GetArgumentAtIndex(0); if (first_arg) { - // Yes the first argument is an executable, set it as the executable - // in the launch options. Don't resolve the file path as the path - // could be a remote platform path + // Yes the first argument is an executable, set it as the executable in + // the launch options. Don't resolve the file path as the path could be a + // remote platform path const bool resolve = false; m_executable.SetFile(first_arg, resolve); } @@ -110,9 +110,9 @@ if (first_arg_is_executable) { const char *first_arg = m_arguments.GetArgumentAtIndex(0); if (first_arg) { - // Yes the first argument is an executable, set it as the executable - // in the launch options. Don't resolve the file path as the path - // could be a remote platform path + // Yes the first argument is an executable, set it as the executable in + // the launch options. Don't resolve the file path as the path could be a + // remote platform path const bool resolve = false; m_executable.SetFile(first_arg, resolve); } Index: lldb/trunk/source/Target/ProcessLaunchInfo.cpp =================================================================== --- lldb/trunk/source/Target/ProcessLaunchInfo.cpp +++ lldb/trunk/source/Target/ProcessLaunchInfo.cpp @@ -210,8 +210,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // If nothing for stdin or stdout or stderr was specified, then check the - // process for any default - // settings that were set with "settings set" + // process for any default settings that were set with "settings set" if (GetFileActionForFD(STDIN_FILENO) == nullptr || GetFileActionForFD(STDOUT_FILENO) == nullptr || GetFileActionForFD(STDERR_FILENO) == nullptr) { @@ -221,8 +220,8 @@ __FUNCTION__); if (m_flags.Test(eLaunchFlagLaunchInTTY)) { - // Do nothing, if we are launching in a remote terminal - // no file actions should be done at all. + // Do nothing, if we are launching in a remote terminal no file actions + // should be done at all. return; } @@ -235,16 +234,15 @@ AppendSuppressFileAction(STDOUT_FILENO, false, true); AppendSuppressFileAction(STDERR_FILENO, false, true); } else { - // Check for any values that might have gotten set with any of: - // (lldb) settings set target.input-path - // (lldb) settings set target.output-path + // Check for any values that might have gotten set with any of: (lldb) + // settings set target.input-path (lldb) settings set target.output-path // (lldb) settings set target.error-path FileSpec in_file_spec; FileSpec out_file_spec; FileSpec err_file_spec; if (target) { - // Only override with the target settings if we don't already have - // an action for in, out or error + // Only override with the target settings if we don't already have an + // action for in, out or error if (GetFileActionForFD(STDIN_FILENO) == nullptr) in_file_spec = target->GetStandardInputPath(); if (GetFileActionForFD(STDOUT_FILENO) == nullptr) @@ -295,9 +293,9 @@ int open_flags = O_RDWR | O_NOCTTY; #if !defined(_WIN32) - // We really shouldn't be specifying platform specific flags - // that are intended for a system call in generic code. But - // this will have to do for now. + // We really shouldn't be specifying platform specific flags that are + // intended for a system call in generic code. But this will have to + // do for now. open_flags |= O_CLOEXEC; #endif if (m_pty->OpenFirstAvailableMaster(open_flags, nullptr, 0)) { @@ -351,14 +349,13 @@ StreamString shell_command; if (will_debug) { - // Add a modified PATH environment variable in case argv[0] - // is a relative path. + // Add a modified PATH environment variable in case argv[0] is a + // relative path. const char *argv0 = argv[0]; FileSpec arg_spec(argv0, false); if (arg_spec.IsRelative()) { - // We have a relative path to our executable which may not work if - // we just try to run "a.out" (without it being converted to - // "./a.out") + // We have a relative path to our executable which may not work if we + // just try to run "a.out" (without it being converted to "./a.out") FileSpec working_dir = GetWorkingDirectory(); // Be sure to put quotes around PATH's value in case any paths have // spaces... @@ -410,8 +407,8 @@ } if (first_arg_is_full_shell_command) { - // There should only be one argument that is the shell command itself to - // be used as is + // There should only be one argument that is the shell command itself + // to be used as is if (argv[0] && !argv[1]) shell_command.Printf("%s", argv[0]); else Index: lldb/trunk/source/Target/RegisterContext.cpp =================================================================== --- lldb/trunk/source/Target/RegisterContext.cpp +++ lldb/trunk/source/Target/RegisterContext.cpp @@ -76,8 +76,7 @@ ExecutionContext exe_ctx(CalculateThread()); // In MIPS, the floating point registers size is depends on FR bit of SR - // register. - // if SR.FR == 1 then all floating point registers are 64 bits. + // register. if SR.FR == 1 then all floating point registers are 64 bits. // else they are all 32 bits. int expr_result; @@ -262,8 +261,7 @@ RegisterValue reg_value; // If we can reconstruct the register from the frame we are copying from, - // then do so, otherwise - // use the value from frame 0. + // then do so, otherwise use the value from frame 0. if (context->ReadRegister(reg_info, reg_value)) { WriteRegister(reg_info, reg_value); } else if (frame_zero_context->ReadRegister(reg_info, reg_value)) { @@ -355,12 +353,11 @@ return error; } - // We now have a memory buffer that contains the part or all of the register - // value. Set the register value using this memory data. + // We now have a memory buffer that contains the part or all of the + // register value. Set the register value using this memory data. // TODO: we might need to add a parameter to this function in case the byte // order of the memory data doesn't match the process. For now we are - // assuming - // they are the same. + // assuming they are the same. reg_value.SetFromMemoryData(reg_info, src, src_len, process_sp->GetByteOrder(), error); } else @@ -381,8 +378,7 @@ // TODO: we might need to add a parameter to this function in case the byte // order of the memory data doesn't match the process. For now we are - // assuming - // they are the same. + // assuming they are the same. const uint32_t bytes_copied = reg_value.GetAsMemoryData( reg_info, dst, dst_len, process_sp->GetByteOrder(), error); @@ -431,9 +427,9 @@ } StackFrameSP RegisterContext::CalculateStackFrame() { - // Register contexts might belong to many frames if we have inlined - // functions inside a frame since all inlined functions share the - // same registers, so we can't definitively say which frame we come from... + // Register contexts might belong to many frames if we have inlined functions + // inside a frame since all inlined functions share the same registers, so we + // can't definitively say which frame we come from... return StackFrameSP(); } Index: lldb/trunk/source/Target/SectionLoadHistory.cpp =================================================================== --- lldb/trunk/source/Target/SectionLoadHistory.cpp +++ lldb/trunk/source/Target/SectionLoadHistory.cpp @@ -43,13 +43,12 @@ if (!m_stop_id_to_section_load_list.empty()) { if (read_only) { // The section load list is for reading data only so we don't need to - // create - // a new SectionLoadList for the current stop ID, just return the section - // load list for the stop ID that is equal to or less than the current - // stop ID + // create a new SectionLoadList for the current stop ID, just return the + // section load list for the stop ID that is equal to or less than the + // current stop ID if (stop_id == eStopIDNow) { - // If we are asking for the latest and greatest value, it is always - // at the end of our list because that will be the highest stop ID. + // If we are asking for the latest and greatest value, it is always at + // the end of our list because that will be the highest stop ID. StopIDToSectionLoadList::reverse_iterator rpos = m_stop_id_to_section_load_list.rbegin(); return rpos->second.get(); @@ -70,10 +69,8 @@ assert(stop_id != eStopIDNow); // We are updating the section load list (not read only), so if the stop - // ID - // passed in isn't the same as the last stop ID in our collection, then - // create - // a new node using the current stop ID + // ID passed in isn't the same as the last stop ID in our collection, + // then create a new node using the current stop ID StopIDToSectionLoadList::iterator pos = m_stop_id_to_section_load_list.lower_bound(stop_id); if (pos != m_stop_id_to_section_load_list.end() && Index: lldb/trunk/source/Target/SectionLoadList.cpp =================================================================== --- lldb/trunk/source/Target/SectionLoadList.cpp +++ lldb/trunk/source/Target/SectionLoadList.cpp @@ -97,12 +97,12 @@ // we have multiple load addresses that correspond to a section, we will // always attribute the section to the be last section that claims it // exists at that address. Sometimes it is ok for more that one section - // to be loaded at a specific load address, and other times it isn't. - // The "warn_multiple" parameter tells us if we should warn in this case - // or not. The DynamicLoader plug-in subclasses should know which - // sections should warn and which shouldn't (darwin shared cache modules - // all shared the same "__LINKEDIT" sections, so the dynamic loader can - // pass false for "warn_multiple"). + // to be loaded at a specific load address, and other times it isn't. The + // "warn_multiple" parameter tells us if we should warn in this case or + // not. The DynamicLoader plug-in subclasses should know which sections + // should warn and which shouldn't (darwin shared cache modules all + // shared the same "__LINKEDIT" sections, so the dynamic loader can pass + // false for "warn_multiple"). if (warn_multiple && section != ats_pos->second) { ModuleSP module_sp(section->GetModule()); if (module_sp) { @@ -228,8 +228,8 @@ } } } else { - // There are no entries that have an address that is >= load_addr, - // so we need to check the last entry on our collection. + // There are no entries that have an address that is >= load_addr, so we + // need to check the last entry on our collection. addr_to_sect_collection::const_reverse_iterator rpos = m_addr_to_sect.rbegin(); if (load_addr >= rpos->first) { Index: lldb/trunk/source/Target/StackFrame.cpp =================================================================== --- lldb/trunk/source/Target/StackFrame.cpp +++ lldb/trunk/source/Target/StackFrame.cpp @@ -60,8 +60,8 @@ m_is_history_frame(is_history_frame), m_variable_list_sp(), m_variable_list_value_objects(), m_disassembly(), m_mutex() { // If we don't have a CFA value, use the frame index for our StackID so that - // recursive - // functions properly aren't confused with one another on a history stack. + // recursive functions properly aren't confused with one another on a history + // stack. if (m_is_history_frame && !m_cfa_is_valid) { m_id.SetCFA(m_frame_index); } @@ -136,17 +136,17 @@ StackID &StackFrame::GetStackID() { std::lock_guard guard(m_mutex); - // Make sure we have resolved the StackID object's symbol context scope if - // we already haven't looked it up. + // Make sure we have resolved the StackID object's symbol context scope if we + // already haven't looked it up. if (m_flags.IsClear(RESOLVED_FRAME_ID_SYMBOL_SCOPE)) { if (m_id.GetSymbolContextScope()) { - // We already have a symbol context scope, we just don't have our - // flag bit set. + // We already have a symbol context scope, we just don't have our flag + // bit set. m_flags.Set(RESOLVED_FRAME_ID_SYMBOL_SCOPE); } else { - // Calculate the frame block and use this for the stack ID symbol - // context scope if we have one. + // Calculate the frame block and use this for the stack ID symbol context + // scope if we have one. SymbolContextScope *scope = GetFrameBlock(); if (scope == nullptr) { // We don't have a block, so use the symbol @@ -247,13 +247,13 @@ if (m_sc.block) { Block *inline_block = m_sc.block->GetContainingInlinedBlock(); if (inline_block) { - // Use the block with the inlined function info - // as the frame block we want this frame to have only the variables - // for the inlined function and its non-inlined block child blocks. + // Use the block with the inlined function info as the frame block we + // want this frame to have only the variables for the inlined function + // and its non-inlined block child blocks. return inline_block; } else { - // This block is not contained within any inlined function blocks - // with so we want to use the top most function block. + // This block is not contained within any inlined function blocks with so + // we want to use the top most function block. return &m_sc.function->GetBlock(false); } } @@ -263,8 +263,8 @@ //---------------------------------------------------------------------- // Get the symbol context if we already haven't done so by resolving the // PC address as much as possible. This way when we pass around a -// StackFrame object, everyone will have as much information as -// possible and no one will ever have to look things up manually. +// StackFrame object, everyone will have as much information as possible and no +// one will ever have to look things up manually. //---------------------------------------------------------------------- const SymbolContext &StackFrame::GetSymbolContext(uint32_t resolve_scope) { std::lock_guard guard(m_mutex); @@ -279,15 +279,15 @@ resolved |= eSymbolContextTarget; } - // Resolve our PC to section offset if we haven't already done so - // and if we don't have a module. The resolved address section will - // contain the module to which it belongs + // Resolve our PC to section offset if we haven't already done so and if we + // don't have a module. The resolved address section will contain the + // module to which it belongs if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR)) GetFrameCodeAddress(); - // If this is not frame zero, then we need to subtract 1 from the PC - // value when doing address lookups since the PC will be on the - // instruction following the function call instruction... + // If this is not frame zero, then we need to subtract 1 from the PC value + // when doing address lookups since the PC will be on the instruction + // following the function call instruction... Address lookup_addr(GetFrameCodeAddress()); if (m_frame_index > 0 && lookup_addr.IsValid()) { @@ -296,10 +296,9 @@ lookup_addr.SetOffset(offset - 1); } else { - // lookup_addr is the start of a section. We need - // do the math on the actual load address and re-compute - // the section. We're working with a 'noreturn' function - // at the end of a section. + // lookup_addr is the start of a section. We need do the math on the + // actual load address and re-compute the section. We're working with + // a 'noreturn' function at the end of a section. ThreadSP thread_sp(GetThread()); if (thread_sp) { TargetSP target_sp(thread_sp->CalculateTarget()); @@ -315,9 +314,9 @@ } if (m_sc.module_sp) { - // We have something in our stack frame symbol context, lets check - // if we haven't already tried to lookup one of those things. If we - // haven't then we will do the query. + // We have something in our stack frame symbol context, lets check if we + // haven't already tried to lookup one of those things. If we haven't + // then we will do the query. uint32_t actual_resolve_scope = 0; @@ -367,17 +366,16 @@ } if (actual_resolve_scope) { - // We might be resolving less information than what is already - // in our current symbol context so resolve into a temporary - // symbol context "sc" so we don't clear out data we have - // already found in "m_sc" + // We might be resolving less information than what is already in our + // current symbol context so resolve into a temporary symbol context + // "sc" so we don't clear out data we have already found in "m_sc" SymbolContext sc; // Set flags that indicate what we have tried to resolve resolved |= m_sc.module_sp->ResolveSymbolContextForAddress( lookup_addr, actual_resolve_scope, sc); - // Only replace what we didn't already have as we may have - // information for an inlined function scope that won't match - // what a standard lookup by address would match + // Only replace what we didn't already have as we may have information + // for an inlined function scope that won't match what a standard + // lookup by address would match if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == nullptr) m_sc.comp_unit = sc.comp_unit; if ((resolved & eSymbolContextFunction) && m_sc.function == nullptr) @@ -404,9 +402,9 @@ // Update our internal flags so we remember what we have tried to locate so // we don't have to keep trying when more calls to this function are made. - // We might have dug up more information that was requested (for example - // if we were asked to only get the block, we will have gotten the - // compile unit, and function) so set any additional bits that we resolved + // We might have dug up more information that was requested (for example if + // we were asked to only get the block, we will have gotten the compile + // unit, and function) so set any additional bits that we resolved m_flags.Set(resolve_scope | resolved); } @@ -546,8 +544,8 @@ } if (!var_sp && (options & eExpressionPathOptionsAllowDirectIVarAccess)) { - // Check for direct ivars access which helps us with implicit - // access to ivars with the "this->" or "self->" + // Check for direct ivars access which helps us with implicit access to + // ivars with the "this->" or "self->" GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock); lldb::LanguageType method_language = eLanguageTypeUnknown; bool is_instance_method = false; @@ -622,9 +620,8 @@ valobj_sp->GetCompilerType().GetTypeInfo(nullptr); if ((pointer_type_flags & eTypeIsObjC) && (pointer_type_flags & eTypeIsPointer)) { - // This was an objective C object pointer and - // it was requested we skip any fragile ivars - // so return nothing here + // This was an objective C object pointer and it was requested we + // skip any fragile ivars so return nothing here return ValueObjectSP(); } } @@ -659,15 +656,14 @@ ConstString child_name(var_expr.substr(0, var_expr.find_first_of(".-["))); if (check_ptr_vs_member) { - // We either have a pointer type and need to verify - // valobj_sp is a pointer, or we have a member of a - // class/union/struct being accessed with the . syntax - // and need to verify we don't have a pointer. + // We either have a pointer type and need to verify valobj_sp is a + // pointer, or we have a member of a class/union/struct being accessed + // with the . syntax and need to verify we don't have a pointer. const bool actual_is_ptr = valobj_sp->IsPointerType(); if (actual_is_ptr != expr_is_ptr) { - // Incorrect use of "." with a pointer, or "->" with - // a class/union/struct instance or reference. + // Incorrect use of "." with a pointer, or "->" with a + // class/union/struct instance or reference. valobj_sp->GetExpressionPath(var_expr_path_strm, false); if (actual_is_ptr) error.SetErrorStringWithFormat( @@ -697,10 +693,8 @@ // No child member with name "child_name" if (synthetically_added_instance_object) { // We added a "this->" or "self->" to the beginning of the - // expression - // and this is the first pointer ivar access, so just return - // the normal - // error + // expression and this is the first pointer ivar access, so just + // return the normal error error.SetErrorStringWithFormat( "no variable or instance variable named '%s' found in " "this frame", @@ -735,8 +729,8 @@ } break; case '[': { - // Array member access, or treating pointer as an array - // Need at least two brackets and a number + // Array member access, or treating pointer as an array Need at least two + // brackets and a number if (var_expr.size() <= 2) { error.SetErrorStringWithFormat( "invalid square bracket encountered after \"%s\" in \"%s\"", @@ -790,11 +784,10 @@ deref = false; } else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() && deref) { - // what we have is *arr[low]. the most similar C++ syntax is - // to get arr[0] - // (an operation that is equivalent to deref-ing arr) - // and extract bit low out of it. reading array item low - // would be done by saying arr[low], without a deref * sign + // what we have is *arr[low]. the most similar C++ syntax is to get + // arr[0] (an operation that is equivalent to deref-ing arr) and + // extract bit low out of it. reading array item low would be done by + // saying arr[low], without a deref * sign Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { @@ -828,8 +821,8 @@ return ValueObjectSP(); } else if (is_objc_pointer) { - // dereferencing ObjC variables is not valid.. so let's try - // and recur to synthetic children + // dereferencing ObjC variables is not valid.. so let's try and + // recur to synthetic children ValueObjectSP synthetic = valobj_sp->GetSyntheticValue(); if (!synthetic /* no synthetic */ || synthetic == valobj_sp) /* synthetic is the same as @@ -874,9 +867,8 @@ } } else if (valobj_sp->GetCompilerType().IsArrayType( nullptr, nullptr, &is_incomplete_array)) { - // Pass false to dynamic_value here so we can tell the - // difference between - // no dynamic value and no member of this type... + // Pass false to dynamic_value here so we can tell the difference + // between no dynamic value and no member of this type... child_valobj_sp = valobj_sp->GetChildAtIndex(child_index, true); if (!child_valobj_sp && (is_incomplete_array || !no_synth_child)) child_valobj_sp = @@ -976,8 +968,8 @@ if (valobj_sp->GetCompilerType().IsPointerToScalarType() && deref) { // what we have is *ptr[low-high]. the most similar C++ syntax is to // deref ptr and extract bits low thru high out of it. reading array - // items low thru high would be done by saying ptr[low-high], without - // a deref * sign + // items low thru high would be done by saying ptr[low-high], without a + // deref * sign Status error; ValueObjectSP temp(valobj_sp->Dereference(error)); if (error.Fail()) { @@ -991,10 +983,10 @@ valobj_sp = temp; deref = false; } else if (valobj_sp->GetCompilerType().IsArrayOfScalarType() && deref) { - // what we have is *arr[low-high]. the most similar C++ syntax is to get - // arr[0] (an operation that is equivalent to deref-ing arr) and extract - // bits low thru high out of it. reading array items low thru high would - // be done by saying arr[low-high], without a deref * sign + // what we have is *arr[low-high]. the most similar C++ syntax is to + // get arr[0] (an operation that is equivalent to deref-ing arr) and + // extract bits low thru high out of it. reading array items low thru + // high would be done by saying arr[low-high], without a deref * sign Status error; ValueObjectSP temp(valobj_sp->GetChildAtIndex(0, true)); if (error.Fail()) { @@ -1091,8 +1083,8 @@ if (m_sc.function->GetFrameBaseExpression().Evaluate( &exe_ctx, nullptr, loclist_base_addr, nullptr, nullptr, expr_value, &m_frame_base_error) == false) { - // We should really have an error if evaluate returns, but in case - // we don't, lets set the error to something at least. + // We should really have an error if evaluate returns, but in case we + // don't, lets set the error to something at least. if (m_frame_base_error.Success()) m_frame_base_error.SetErrorString( "Evaluation of the frame base expression failed."); @@ -1420,8 +1412,8 @@ ValueObjectSP &base, int64_t offset) { // base is a pointer to something - // offset is the thing to add to the pointer - // We return the most sensible ValueObject for the result of *(base+offset) + // offset is the thing to add to the pointer We return the most sensible + // ValueObject for the result of *(base+offset) if (!base->IsPointerOrReferenceType()) { return ValueObjectSP(); @@ -1486,8 +1478,8 @@ // // f, a pointer to a struct, is known to be at -0x8(%rbp). // - // DoGuessValueAt(frame, rdi, 4, dis, vars, 0x22) finds the instruction at +18 - // that assigns to rdi, and calls itself recursively for that dereference + // DoGuessValueAt(frame, rdi, 4, dis, vars, 0x22) finds the instruction at + // +18 that assigns to rdi, and calls itself recursively for that dereference // DoGuessValueAt(frame, rdi, 8, dis, vars, 0x18) finds the instruction at // +14 that assigns to rdi, and calls itself recursively for that // derefernece @@ -1533,9 +1525,9 @@ for (uint32_t ii = current_inst - 1; ii != (uint32_t)-1; --ii) { // This is not an exact algorithm, and it sacrifices accuracy for - // generality. Recognizing "mov" and "ld" instructions –– and which are - // their source and destination operands -- is something the disassembler - // should do for us. + // generality. Recognizing "mov" and "ld" instructions –– and which + // are their source and destination operands -- is something the + // disassembler should do for us. InstructionSP instruction_sp = disassembler.GetInstructionList().GetInstructionAtIndex(ii); Index: lldb/trunk/source/Target/StackFrameList.cpp =================================================================== --- lldb/trunk/source/Target/StackFrameList.cpp +++ lldb/trunk/source/Target/StackFrameList.cpp @@ -51,8 +51,8 @@ } StackFrameList::~StackFrameList() { - // Call clear since this takes a lock and clears the stack frame list - // in case another thread is currently using this stack frame list + // Call clear since this takes a lock and clears the stack frame list in case + // another thread is currently using this stack frame list Clear(); } @@ -95,13 +95,12 @@ log->Printf( "ResetCurrentInlinedDepth: Invalidating current inlined depth.\n"); } else { - // We only need to do something special about inlined blocks when we - // are at the beginning of an inlined function: + // We only need to do something special about inlined blocks when we are + // at the beginning of an inlined function: // FIXME: We probably also have to do something special if the PC is at // the END // of an inlined function, which coincides with the end of either its - // containing - // function or another inlined function. + // containing function or another inlined function. lldb::addr_t curr_pc = m_thread.GetRegisterContext()->GetPC(); Block *block_ptr = m_frames[0]->GetFrameBlock(); @@ -114,19 +113,15 @@ containing_range)) { if (pc_as_address == containing_range.GetBaseAddress()) { // If we got here because of a breakpoint hit, then set the inlined - // depth depending on where - // the breakpoint was set. - // If we got here because of a crash, then set the inlined depth to - // the deepest most block. - // Otherwise, we stopped here naturally as the result of a step, so - // set ourselves in the - // containing frame of the whole set of nested inlines, so the user - // can then "virtually" - // step into the frames one by one, or next over the whole mess. - // Note: We don't have to handle being somewhere in the middle of - // the stack here, since - // ResetCurrentInlinedDepth doesn't get called if there is a valid - // inlined depth set. + // depth depending on where the breakpoint was set. If we got here + // because of a crash, then set the inlined depth to the deepest + // most block. Otherwise, we stopped here naturally as the result + // of a step, so set ourselves in the containing frame of the whole + // set of nested inlines, so the user can then "virtually" step + // into the frames one by one, or next over the whole mess. Note: + // We don't have to handle being somewhere in the middle of the + // stack here, since ResetCurrentInlinedDepth doesn't get called if + // there is a valid inlined depth set. StopInfoSP stop_info_sp = m_thread.GetStopInfo(); if (stop_info_sp) { switch (stop_info_sp->GetStopReason()) { @@ -134,7 +129,8 @@ case eStopReasonException: case eStopReasonExec: case eStopReasonSignal: - // In all these cases we want to stop in the deepest most frame. + // In all these cases we want to stop in the deepest most + // frame. m_current_inlined_pc = curr_pc; m_current_inlined_depth = 0; break; @@ -142,17 +138,14 @@ // FIXME: Figure out what this break point is doing, and set the // inline depth // appropriately. Be careful to take into account breakpoints - // that implement - // step over prologue, since that should do the default - // calculation. - // For now, if the breakpoints corresponding to this hit are all - // internal, + // that implement step over prologue, since that should do the + // default calculation. For now, if the breakpoints + // corresponding to this hit are all internal, // I set the stop location to the top of the inlined stack, // since that will make - // things like stepping over prologues work right. But if there - // are any non-internal - // breakpoints I do to the bottom of the stack, since that was - // the old behavior. + // things like stepping over prologues work right. But if + // there are any non-internal breakpoints I do to the bottom of + // the stack, since that was the old behavior. uint32_t bp_site_id = stop_info_sp->GetValue(); BreakpointSiteSP bp_site_sp( m_thread.GetProcess()->GetBreakpointSiteList().FindByID( @@ -177,10 +170,9 @@ LLVM_FALLTHROUGH; default: { // Otherwise, we should set ourselves at the container of the - // inlining, so that the - // user can descend into them. - // So first we check whether we have more than one inlined block - // sharing this PC: + // inlining, so that the user can descend into them. So first + // we check whether we have more than one inlined block sharing + // this PC: int num_inlined_functions = 0; for (Block *container_ptr = block_ptr->GetInlinedParent(); @@ -250,13 +242,11 @@ #if defined(DEBUG_STACK_FRAMES) StreamFile s(stdout, false); #endif - // If we are hiding some frames from the outside world, we need to add those - // onto the total count of - // frames to fetch. However, we don't need to do that if end_idx is 0 since - // in that case we always - // get the first concrete frame and all the inlined frames below it... And - // of course, if end_idx is - // UINT32_MAX that means get all, so just do that... + // If we are hiding some frames from the outside world, we need to add + // those onto the total count of frames to fetch. However, we don't need + // to do that if end_idx is 0 since in that case we always get the first + // concrete frame and all the inlined frames below it... And of course, if + // end_idx is UINT32_MAX that means get all, so just do that... uint32_t inlined_depth = 0; if (end_idx > 0 && end_idx != UINT32_MAX) { @@ -273,17 +263,17 @@ lldb::addr_t pc = LLDB_INVALID_ADDRESS; lldb::addr_t cfa = LLDB_INVALID_ADDRESS; if (idx == 0) { - // We might have already created frame zero, only create it - // if we need to + // We might have already created frame zero, only create it if we need + // to if (m_frames.empty()) { RegisterContextSP reg_ctx_sp(m_thread.GetRegisterContext()); if (reg_ctx_sp) { const bool success = unwinder && unwinder->GetFrameInfoAtIndex(idx, cfa, pc); - // There shouldn't be any way not to get the frame info for frame 0. - // But if the unwinder can't make one, lets make one by hand with - // the + // There shouldn't be any way not to get the frame info for frame + // 0. But if the unwinder can't make one, lets make one by hand + // with the // SP as the CFA and see if that gets any further. if (!success) { cfa = reg_ctx_sp->GetSP(); @@ -323,18 +313,16 @@ if (unwind_block) { Address curr_frame_address(unwind_frame_sp->GetFrameCodeAddress()); TargetSP target_sp = m_thread.CalculateTarget(); - // Be sure to adjust the frame address to match the address - // that was used to lookup the symbol context above. If we are - // in the first concrete frame, then we lookup using the current - // address, else we decrement the address by one to get the correct - // location. + // Be sure to adjust the frame address to match the address that was + // used to lookup the symbol context above. If we are in the first + // concrete frame, then we lookup using the current address, else we + // decrement the address by one to get the correct location. if (idx > 0) { if (curr_frame_address.GetOffset() == 0) { // If curr_frame_address points to the first address in a section - // then after - // adjustment it will point to an other section. In that case - // resolve the - // address again to the correct section plus offset form. + // then after adjustment it will point to an other section. In that + // case resolve the address again to the correct section plus + // offset form. addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress( target_sp.get(), eAddressClassCode); curr_frame_address.SetOpcodeLoadAddress( @@ -414,8 +402,8 @@ break; prev_frame->UpdatePreviousFrameFromCurrentFrame(*curr_frame); - // Now copy the fixed up previous frame into the current frames - // so the pointer doesn't change + // Now copy the fixed up previous frame into the current frames so the + // pointer doesn't change m_frames[curr_frame_idx] = prev_frame_sp; // curr_frame->UpdateCurrentFrameFromPreviousFrame (*prev_frame); @@ -495,9 +483,8 @@ if (frame_sp) return frame_sp; - // GetFramesUpTo will fill m_frames with as many frames as you asked for, - // if there are that many. If there weren't then you asked for too many - // frames. + // GetFramesUpTo will fill m_frames with as many frames as you asked for, if + // there are that many. If there weren't then you asked for too many frames. GetFramesUpTo(idx); if (idx < m_frames.size()) { if (m_show_inlined_frames) { @@ -519,8 +506,8 @@ Function *function = frame_sp->GetSymbolContext(eSymbolContextFunction).function; if (function) { - // When we aren't showing inline functions we always use - // the top most function block as the scope. + // When we aren't showing inline functions we always use the top + // most function block as the scope. frame_sp->SetSymbolContextScope(&function->GetBlock(false)); } else { // Set the symbol scope from the symbol regardless if it is nullptr @@ -534,9 +521,8 @@ } } else if (original_idx == 0) { // There should ALWAYS be a frame at index 0. If something went wrong with - // the CurrentInlinedDepth such that - // there weren't as many frames as we thought taking that into account, then - // reset the current inlined depth + // the CurrentInlinedDepth such that there weren't as many frames as we + // thought taking that into account, then reset the current inlined depth // and return the real zeroth frame. if (m_frames.empty()) { // Why do we have a thread with zero frames, that should not ever @@ -554,11 +540,11 @@ StackFrameSP StackFrameList::GetFrameWithConcreteFrameIndex(uint32_t unwind_idx) { // First try assuming the unwind index is the same as the frame index. The - // unwind index is always greater than or equal to the frame index, so it - // is a good place to start. If we have inlined frames we might have 5 - // concrete frames (frame unwind indexes go from 0-4), but we might have 15 - // frames after we make all the inlined frames. Most of the time the unwind - // frame index (or the concrete frame index) is the same as the frame index. + // unwind index is always greater than or equal to the frame index, so it is + // a good place to start. If we have inlined frames we might have 5 concrete + // frames (frame unwind indexes go from 0-4), but we might have 15 frames + // after we make all the inlined frames. Most of the time the unwind frame + // index (or the concrete frame index) is the same as the frame index. uint32_t frame_idx = unwind_idx; StackFrameSP frame_sp(GetFrameAtIndex(frame_idx)); while (frame_sp) { @@ -719,9 +705,9 @@ #if defined(DEBUG_STACK_FRAMES) s.PutCString("No previous frames, so use current frames...\n"); #endif - // We either don't have any previous frames, or since we have more than - // one current frames it means we have all the frames and can safely - // replace our previous frames. + // We either don't have any previous frames, or since we have more than one + // current frames it means we have all the frames and can safely replace + // our previous frames. prev_sp.reset(curr_ap.release()); return; } @@ -733,8 +719,8 @@ s.PutCString( "We have more than one current frame, so use current frames...\n"); #endif - // We have more than one current frames it means we have all the frames - // and can safely replace our previous frames. + // We have more than one current frames it means we have all the frames and + // can safely replace our previous frames. prev_sp.reset(curr_ap.release()); #if defined(DEBUG_STACK_FRAMES) Index: lldb/trunk/source/Target/StackID.cpp =================================================================== --- lldb/trunk/source/Target/StackID.cpp +++ lldb/trunk/source/Target/StackID.cpp @@ -69,12 +69,11 @@ // FIXME: We are assuming that the stacks grow downward in memory. That's not // necessary, but true on // all the machines we care about at present. If this changes, we'll have to - // deal with that. The ABI is the - // agent who knows this ordering, but the StackID has no access to the ABI. - // The most straightforward way - // to handle this is to add a "m_grows_downward" bool to the StackID, and set - // it in the constructor. - // But I'm not going to waste a bool per StackID on this till we need it. + // deal with that. The ABI is the agent who knows this ordering, but the + // StackID has no access to the ABI. The most straightforward way to handle + // this is to add a "m_grows_downward" bool to the StackID, and set it in the + // constructor. But I'm not going to waste a bool per StackID on this till we + // need it. if (lhs_cfa != rhs_cfa) return lhs_cfa < rhs_cfa; Index: lldb/trunk/source/Target/StopInfo.cpp =================================================================== --- lldb/trunk/source/Target/StopInfo.cpp +++ lldb/trunk/source/Target/StopInfo.cpp @@ -63,12 +63,10 @@ return true; } else if (ret_type == eStateStopped) { // This is a little tricky. We want to count "run and stopped again - // before you could - // ask this question as a "TRUE" answer to HasTargetRunSinceMe. But we - // don't want to - // include any running of the target done for expressions. So we track - // both resumes, - // and resumes caused by expressions, and check if there are any resumes + // before you could ask this question as a "TRUE" answer to + // HasTargetRunSinceMe. But we don't want to include any running of the + // target done for expressions. So we track both resumes, and resumes + // caused by expressions, and check if there are any resumes // NOT caused // by expressions. @@ -199,8 +197,7 @@ if (bp_site_sp) { StreamString strm; // If we have just hit an internal breakpoint, and it has a kind - // description, print that instead of the - // full breakpoint printing: + // description, print that instead of the full breakpoint printing: if (bp_site_sp->IsInternal()) { size_t num_owners = bp_site_sp->GetNumberOfOwners(); for (size_t idx = 0; idx < num_owners; idx++) { @@ -258,9 +255,9 @@ protected: bool ShouldStop(Event *event_ptr) override { - // This just reports the work done by PerformAction or the synchronous stop. - // It should - // only ever get called after they have had a chance to run. + // This just reports the work done by PerformAction or the synchronous + // stop. It should only ever get called after they have had a chance to + // run. assert(m_should_stop_is_valid); return m_should_stop; } @@ -293,54 +290,47 @@ if (bp_site_sp) { // Let's copy the owners list 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. + // 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; size_t num_owners = bp_site_sp->CopyOwnersList(site_locations); if (num_owners == 0) { m_should_stop = true; } else { - // We go through each location, and test first its precondition - this - // overrides everything. Note, - // we only do this once per breakpoint - not once per location... - // Then check the condition. If the condition says to stop, - // then we run the callback for that location. If that callback says - // to stop as well, then - // we set m_should_stop to true; we are going to stop. - // But we still want to give all the breakpoints whose conditions say - // we are going to stop a - // chance to run their callbacks. - // Of course if any callback restarts the target by putting "continue" - // in the callback, then + // We go through each location, and test first its precondition - + // this overrides everything. Note, we only do this once per + // breakpoint - not once per location... Then check the condition. + // If the condition says to stop, then we run the callback for that + // location. If that callback says to stop as well, then we set + // m_should_stop to true; we are going to stop. But we still want to + // give all the breakpoints whose conditions say we are going to stop + // a chance to run their callbacks. Of course if any callback + // restarts the target by putting "continue" in the callback, then // 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. + // 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; // We don't select threads as we go through them testing breakpoint - // conditions and running commands. - // So we need to set the thread for expression evaluation here: + // conditions and running commands. So we need to set the thread for + // expression evaluation here: ThreadList::ExpressionExecutionThreadPusher thread_pusher(thread_sp); ExecutionContext exe_ctx(thread_sp->GetStackFrameAtIndex(0)); Process *process = exe_ctx.GetProcessPtr(); if (process->GetModIDRef().IsLastResumeForUserExpression()) { // If we are in the middle of evaluating an expression, don't run - // asynchronous breakpoint commands or - // expressions. That could lead to infinite recursion if the - // command or condition re-calls the function - // with this breakpoint. + // asynchronous breakpoint commands or expressions. That could + // lead to infinite recursion if the command or condition re-calls + // the function with this breakpoint. // 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. + // 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) @@ -377,12 +367,11 @@ StoppointCallbackContext context(event_ptr, exe_ctx, false); // For safety's sake let's also grab an extra reference to the - // breakpoint owners of the locations we're - // going to examine, since the locations are going to have to get back - // to their breakpoints, and the - // locations don't keep their owners alive. I'm just sticking the - // BreakpointSP's in a vector since - // I'm only using it to locally increment their retain counts. + // breakpoint owners of the locations we're going to examine, since + // the locations are going to have to get back to their breakpoints, + // and the locations don't keep their owners alive. I'm just + // sticking the BreakpointSP's in a vector since I'm only using it to + // locally increment their retain counts. std::vector location_owners; @@ -404,8 +393,8 @@ 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: + // not all of them valid for this thread. Skip the ones that + // aren't: if (!bp_loc_sp->ValidForThisThread(thread_sp.get())) { if (log) { log->Printf("Breakpoint %s hit on thread 0x%llx but it was not " @@ -419,8 +408,7 @@ internal_breakpoint = bp_loc_sp->GetBreakpoint().IsInternal(); // First run the precondition, but since the precondition is per - // breakpoint, only run it once - // per breakpoint. + // breakpoint, only run it once per breakpoint. std::pair::iterator, bool> result = precondition_breakpoints.insert( bp_loc_sp->GetBreakpoint().GetID()); @@ -433,9 +421,8 @@ continue; // Next 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. + // 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() != nullptr) { Status condition_error; @@ -470,9 +457,8 @@ } if (!condition_says_stop) { // We don't want to increment the hit count of breakpoints if - // the condition fails. - // We've already bumped it by the time we get here, so undo - // the bump: + // the condition fails. We've already bumped it by the time + // we get here, so undo the bump: bp_loc_sp->UndoBumpHitCount(); continue; } @@ -524,8 +510,8 @@ 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 + // 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()) { m_should_stop = false; @@ -551,13 +537,13 @@ if ((m_should_stop == false || internal_breakpoint) && thread_sp->CompletedPlanOverridesBreakpoint()) { - // Override should_stop decision when we have - // completed step plan additionally to the breakpoint + // Override should_stop decision when we have completed step plan + // additionally to the breakpoint m_should_stop = true; - // Here we clean the preset stop info so the next - // GetStopInfo call will find the appropriate stop info, - // which should be the stop info related to the completed plan + // Here we clean the preset stop info so the next GetStopInfo call will + // find the appropriate stop info, which should be the stop info + // related to the completed plan thread_sp->ResetStopInfo(); } @@ -652,8 +638,8 @@ protected: bool ShouldStopSynchronous(Event *event_ptr) override { - // ShouldStop() method is idempotent and should not affect hit count. - // See Process::RunPrivateStateThread()->Process()->HandlePrivateEvent() + // ShouldStop() method is idempotent and should not affect hit count. See + // Process::RunPrivateStateThread()->Process()->HandlePrivateEvent() // -->Process()::ShouldBroadcastEvent()->ThreadList::ShouldStop()-> // Thread::ShouldStop()->ThreadPlanBase::ShouldStop()-> // StopInfoWatchpoint::ShouldStop() and @@ -689,9 +675,9 @@ } bool ShouldStop(Event *event_ptr) override { - // This just reports the work done by PerformAction or the synchronous stop. - // It should - // only ever get called after they have had a chance to run. + // This just reports the work done by PerformAction or the synchronous + // stop. It should only ever get called after they have had a chance to + // run. assert(m_should_stop_is_valid); return m_should_stop; } @@ -699,8 +685,8 @@ void PerformAction(Event *event_ptr) override { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS); // We're going to calculate if we should stop or not in some way during the - // course of - // this code. Also by default we're going to stop, so set that here. + // course of this code. Also by default we're going to stop, so set that + // here. m_should_stop = true; @@ -716,10 +702,8 @@ { // check if this process is running on an architecture where - // watchpoints trigger - // before the associated instruction runs. if so, disable the WP, - // single-step and then - // re-enable the watchpoint + // watchpoints trigger before the associated instruction runs. if so, + // disable the WP, single-step and then re-enable the watchpoint if (process_sp) { uint32_t num; bool wp_triggers_after; @@ -727,10 +711,9 @@ if (process_sp->GetWatchpointSupportInfo(num, wp_triggers_after) .Success()) { if (!wp_triggers_after) { - // We need to preserve the watch_index before watchpoint - // is disable. Since Watchpoint::SetEnabled will clear the - // watch index. - // This will fix TestWatchpointIter failure + // We need to preserve the watch_index before watchpoint is + // disable. Since Watchpoint::SetEnabled will clear the watch + // index. This will fix TestWatchpointIter failure Watchpoint *wp = wp_sp.get(); uint32_t watch_index = wp->GetHardwareIndex(); process_sp->DisableWatchpoint(wp, false); @@ -759,8 +742,8 @@ } // This sentry object makes sure the current watchpoint is disabled - // while performing watchpoint actions, - // and it is then enabled after we are finished. + // while performing watchpoint actions, and it is then enabled after we + // are finished. WatchpointSentry sentry(process_sp, wp_sp); /* @@ -789,16 +772,13 @@ // TODO: This condition should be checked in the synchronous part of the // watchpoint code // (Watchpoint::ShouldStop), so that we avoid pulling an event even if - // the watchpoint fails - // the ignore count condition. It is moved here temporarily, because for - // archs with - // watchpoint_exceptions_received=before, the code in the previous lines - // takes care of moving - // the inferior to next PC. We have to check the ignore count condition - // after this is done, - // otherwise we will hit same watchpoint multiple times until we pass - // ignore condition, but we - // won't actually be ignoring them. + // the watchpoint fails the ignore count condition. It is moved here + // temporarily, because for archs with + // watchpoint_exceptions_received=before, the code in the previous + // lines takes care of moving the inferior to next PC. We have to check + // the ignore count condition after this is done, otherwise we will hit + // same watchpoint multiple times until we pass ignore condition, but + // we won't actually be ignoring them. if (wp_sp->GetHitCount() <= wp_sp->GetIgnoreCount()) m_should_stop = false; @@ -824,9 +804,9 @@ if (result_value_sp->ResolveValue(scalar_value)) { if (scalar_value.ULongLong(1) == 0) { // We have been vetoed. This takes precedence over querying - // the watchpoint whether it should stop (aka ignore count and - // friends). See also StopInfoWatchpoint::ShouldStop() as - // well as Process::ProcessEventData::DoOnRemoval(). + // the watchpoint whether it should stop (aka ignore count + // and friends). See also StopInfoWatchpoint::ShouldStop() + // as well as Process::ProcessEventData::DoOnRemoval(). m_should_stop = false; } else m_should_stop = true; @@ -877,9 +857,8 @@ debugger.SetAsyncExecution(old_async); - // Also make sure that the callback hasn't continued the target. - // If it did, when we'll set m_should_stop to false and get out of - // here. + // Also make sure that the callback hasn't continued the target. If + // it did, when we'll set m_should_stop to false and get out of here. if (HasTargetRunSinceMe()) m_should_stop = false; Index: lldb/trunk/source/Target/Target.cpp =================================================================== --- lldb/trunk/source/Target/Target.cpp +++ lldb/trunk/source/Target/Target.cpp @@ -382,8 +382,8 @@ // Check for any reason we want to move this breakpoint to other address. addr = GetBreakableLoadAddress(addr); - // Attempt to resolve our load address if possible, though it is ok if - // it doesn't resolve to section/offset. + // Attempt to resolve our load address if possible, though it is ok if it + // doesn't resolve to section/offset. // Try and resolve as a load address if possible GetSectionLoadList().ResolveLoadAddress(addr, so_addr); @@ -537,8 +537,7 @@ SearchFilterSP filter_sp; if (containingModules == nullptr) { // We could make a special "CU List only SearchFilter". Better yet was if - // these could be composable, - // but that will take a little reworking. + // these could be composable, but that will take a little reworking. filter_sp.reset(new SearchFilterByModuleListAndCU( shared_from_this(), FileSpecList(), *containingSourceFiles)); @@ -744,8 +743,8 @@ return true; } -// See also Watchpoint::SetWatchpointType(uint32_t type) and -// the OptionGroupWatchpoint::WatchType enum type. +// See also Watchpoint::SetWatchpointType(uint32_t type) and the +// OptionGroupWatchpoint::WatchType enum type. WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const CompilerType *type, uint32_t kind, Status &error) { @@ -776,8 +775,8 @@ if (!CheckIfWatchpointsExhausted(this, error)) return wp_sp; - // Currently we only support one watchpoint per address, with total number - // of watchpoints limited by the hardware which the inferior is running on. + // Currently we only support one watchpoint per address, with total number of + // watchpoints limited by the hardware which the inferior is running on. // Grab the list mutex while doing operations. const bool notify = false; // Don't notify about all the state changes we do @@ -814,9 +813,8 @@ wp_sp->GetID()); if (error.Fail()) { - // Enabling the watchpoint on the device side failed. - // Remove the said watchpoint from the list maintained by the target - // instance. + // Enabling the watchpoint on the device side failed. Remove the said + // watchpoint from the list maintained by the target instance. m_watchpoint_list.Remove(wp_sp->GetID(), true); // See if we could provide more helpful error message. if (!OptionGroupWatchpoint::IsWatchSizeSupported(size)) @@ -1028,8 +1026,7 @@ Breakpoint *bp = GetBreakpointByID(bp_id).get(); StructuredData::ObjectSP bkpt_save_sp = bp->SerializeToStructuredData(); // If the user explicitly asked to serialize a breakpoint, and we - // can't, then - // raise an error: + // can't, then raise an error: if (!bkpt_save_sp) { error.SetErrorStringWithFormat("Unable to serialize breakpoint %d", bp_id); @@ -1142,8 +1139,8 @@ return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to -// end operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end +// to end operations. bool Target::DisableAllWatchpoints(bool end_to_end) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -1172,8 +1169,8 @@ return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end to -// end operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list for end +// to end operations. bool Target::EnableAllWatchpoints(bool end_to_end) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -1236,8 +1233,8 @@ return true; // Success! } -// Assumption: Caller holds the list mutex lock for m_watchpoint_list -// during these operations. +// Assumption: Caller holds the list mutex lock for m_watchpoint_list during +// these operations. bool Target::IgnoreAllWatchpoints(uint32_t ignore_count) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_WATCHPOINTS)); if (log) @@ -1460,7 +1457,8 @@ if (compatible_local_arch || missing_local_arch) { // If we haven't got a valid arch spec, or the architectures are compatible - // update the architecture, unless the one we already have is more specified + // update the architecture, unless the one we already have is more + // specified if (replace_local_arch) m_arch = other; LLDB_LOG(log, "set architecture to {0} ({1})", @@ -1503,8 +1501,8 @@ bool Target::MergeArchitecture(const ArchSpec &arch_spec) { if (arch_spec.IsValid()) { if (m_arch.GetSpec().IsCompatibleMatch(arch_spec)) { - // The current target arch is compatible with "arch_spec", see if we - // can improve our current architecture using bits from "arch_spec" + // The current target arch is compatible with "arch_spec", see if we can + // improve our current architecture using bits from "arch_spec" // Merge bits from arch_spec into "merged_arch" and set our architecture ArchSpec merged_arch(m_arch.GetSpec()); @@ -1663,8 +1661,8 @@ lldb::addr_t *load_addr_ptr) { error.Clear(); - // if we end up reading this from process memory, we will fill this - // with the actual load address + // if we end up reading this from process memory, we will fill this with the + // actual load address if (load_addr_ptr) *load_addr_ptr = LLDB_INVALID_ADDRESS; @@ -1676,16 +1674,16 @@ if (!addr.IsSectionOffset()) { SectionLoadList §ion_load_list = GetSectionLoadList(); if (section_load_list.IsEmpty()) { - // No sections are loaded, so we must assume we are not running - // yet and anything we are given is a file address. + // No sections are loaded, so we must assume we are not running yet and + // anything we are given is a file address. file_addr = addr.GetOffset(); // "addr" doesn't have a section, so its // offset is the file address m_images.ResolveFileAddress(file_addr, resolved_addr); } else { - // We have at least one section loaded. This can be because - // we have manually loaded some sections with "target modules load ..." - // or because we have have a live process that has sections loaded - // through the dynamic loader + // We have at least one section loaded. This can be because we have + // manually loaded some sections with "target modules load ..." or + // because we have have a live process that has sections loaded through + // the dynamic loader load_addr = addr.GetOffset(); // "addr" doesn't have a section, so its // offset is the load address section_load_list.ResolveLoadAddress(load_addr, resolved_addr); @@ -1732,19 +1730,19 @@ *load_addr_ptr = load_addr; return bytes_read; } - // If the address is not section offset we have an address that - // doesn't resolve to any address in any currently loaded shared - // libraries and we failed to read memory so there isn't anything - // more we can do. If it is section offset, we might be able to - // read cached memory from the object file. + // If the address is not section offset we have an address that doesn't + // resolve to any address in any currently loaded shared libraries and we + // failed to read memory so there isn't anything more we can do. If it is + // section offset, we might be able to read cached memory from the object + // file. if (!resolved_addr.IsSectionOffset()) return 0; } } if (!prefer_file_cache && resolved_addr.IsSectionOffset()) { - // If we didn't already try and read from the object file cache, then - // try it after failing to read from the process. + // If we didn't already try and read from the object file cache, then try + // it after failing to read from the process. return ReadMemoryFromFileCache(resolved_addr, dst, dst_len, error); } return 0; @@ -1761,8 +1759,8 @@ if (length == 0) break; out_str.append(buf, length); - // If we got "length - 1" bytes, we didn't get the whole C string, we - // need to read some more characters + // If we got "length - 1" bytes, we didn't get the whole C string, we need + // to read some more characters if (length == sizeof(buf) - 1) curr_addr += length; else @@ -1783,9 +1781,9 @@ addr_t curr_addr = addr.GetLoadAddress(this); Address address(addr); - // We could call m_process_sp->GetMemoryCacheLineSize() but I don't - // think this really needs to be tied to the memory cache subsystem's - // cache line size, so leave this as a fixed constant. + // We could call m_process_sp->GetMemoryCacheLineSize() but I don't think + // this really needs to be tied to the memory cache subsystem's cache line + // size, so leave this as a fixed constant. const size_t cache_line_size = 512; size_t bytes_left = dst_max_len - 1; @@ -1876,18 +1874,18 @@ if (pointer_vm_addr != LLDB_INVALID_ADDRESS) { SectionLoadList §ion_load_list = GetSectionLoadList(); if (section_load_list.IsEmpty()) { - // No sections are loaded, so we must assume we are not running - // yet and anything we are given is a file address. + // No sections are loaded, so we must assume we are not running yet and + // anything we are given is a file address. m_images.ResolveFileAddress(pointer_vm_addr, pointer_addr); } else { - // We have at least one section loaded. This can be because - // we have manually loaded some sections with "target modules load ..." - // or because we have have a live process that has sections loaded - // through the dynamic loader + // We have at least one section loaded. This can be because we have + // manually loaded some sections with "target modules load ..." or + // because we have have a live process that has sections loaded through + // the dynamic loader section_load_list.ResolveLoadAddress(pointer_vm_addr, pointer_addr); } - // We weren't able to resolve the pointer value, so just return - // an address with no section + // We weren't able to resolve the pointer value, so just return an + // address with no section if (!pointer_addr.IsValid()) pointer_addr.SetOffset(pointer_vm_addr); return true; @@ -1903,9 +1901,8 @@ Status error; // First see if we already have this module in our module list. If we do, - // then we're done, we don't need - // to consult the shared modules list. But only do this if we are passed a - // UUID. + // then we're done, we don't need to consult the shared modules list. But + // only do this if we are passed a UUID. if (module_spec.GetUUID().IsValid()) module_sp = m_images.FindFirstModule(module_spec); @@ -1960,8 +1957,8 @@ } // We found a module that wasn't in our target list. Let's make sure that - // there wasn't an equivalent - // module in the list already, and if there was, let's remove it. + // there wasn't an equivalent module in the list already, and if there was, + // let's remove it. if (module_sp) { ObjectFile *objfile = module_sp->GetObjectFile(); if (objfile) { @@ -1995,18 +1992,14 @@ return ModuleSP(); } // GetSharedModule is not guaranteed to find the old shared module, for - // instance - // in the common case where you pass in the UUID, it is only going to - // find the one - // module matching the UUID. In fact, it has no good way to know what - // the "old module" - // relevant to this target is, since there might be many copies of a - // module with this file spec - // in various running debug sessions, but only one of them will belong - // to this target. - // So let's remove the UUID from the module list, and look in the - // target's module list. - // Only do this if there is SOMETHING else in the module spec... + // instance in the common case where you pass in the UUID, it is only + // going to find the one module matching the UUID. In fact, it has no + // good way to know what the "old module" relevant to this target is, + // since there might be many copies of a module with this file spec in + // various running debug sessions, but only one of them will belong to + // this target. So let's remove the UUID from the module list, and look + // in the target's module list. Only do this if there is SOMETHING else + // in the module spec... if (!old_module_sp) { if (module_spec.GetUUID().IsValid() && !module_spec.GetFileSpec().GetFilename().IsEmpty() && @@ -2286,8 +2279,8 @@ if (expr.empty()) return execution_results; - // We shouldn't run stop hooks in expressions. - // Be sure to reset this if you return anywhere within this function. + // We shouldn't run stop hooks in expressions. Be sure to reset this if you + // return anywhere within this function. bool old_suppress_value = m_suppress_stop_hooks; m_suppress_stop_hooks = true; @@ -2301,8 +2294,8 @@ CalculateExecutionContext(exe_ctx); } - // Make sure we aren't just trying to see the value of a persistent - // variable (something like "$0") + // Make sure we aren't just trying to see the value of a persistent variable + // (something like "$0") lldb::ExpressionVariableSP persistent_var_sp; // Only check for persistent variables the expression starts with a '$' if (expr[0] == '$') @@ -2404,8 +2397,7 @@ code_addr |= 1ull; } else if (addr_class == eAddressClassCodeAlternateISA) { // We checked the address and the address claims to be the alternate - // ISA - // which means thumb, so set bit zero. + // ISA which means thumb, so set bit zero. code_addr |= 1ull; } } @@ -2471,8 +2463,8 @@ SectionLoadList §ion_load_list = GetSectionLoadList(); if (section_load_list.IsEmpty()) - // No sections are loaded, so we must assume we are not running yet - // and need to operate only on file address. + // No sections are loaded, so we must assume we are not running yet and + // need to operate only on file address. m_images.ResolveFileAddress(addr, resolved_addr); else section_load_list.ResolveLoadAddress(addr, resolved_addr); @@ -2547,30 +2539,29 @@ } else if (i == 2) { // Here we may get one 4-byte instruction or two 2-byte instructions. if (num_insns == 2) { - // Looks like there are two 2-byte instructions above our breakpoint - // target address. - // Now the upper 2-byte instruction is either a valid 2-byte - // instruction or could be a part of it's upper 4-byte instruction. - // In both cases we don't care because in this case lower 2-byte - // instruction is definitely a valid instruction - // and whatever i=1 iteration has found out is true. + // Looks like there are two 2-byte instructions above our + // breakpoint target address. Now the upper 2-byte instruction is + // either a valid 2-byte instruction or could be a part of it's + // upper 4-byte instruction. In both cases we don't care because in + // this case lower 2-byte instruction is definitely a valid + // instruction and whatever i=1 iteration has found out is true. inst_to_choose = 1; break; } else if (insn_size == 4) { // This instruction claims its a valid 4-byte instruction. But it - // could be a part of it's upper 4-byte instruction. - // Lets try scanning upper 2 bytes to verify this. + // could be a part of it's upper 4-byte instruction. Lets try + // scanning upper 2 bytes to verify this. instruction_list.Append(prev_insn); inst_to_choose = 2; } } else if (i == 3) { if (insn_size == 4) // FIXME: We reached here that means instruction at [target - 4] has - // already claimed to be a 4-byte instruction, - // and now instruction at [target - 6] is also claiming that it's a - // 4-byte instruction. This can not be true. - // In this case we can not decide the valid previous instruction so - // we let lldb set the breakpoint at the address given by user. + // already claimed to be a 4-byte instruction, and now instruction + // at [target - 6] is also claiming that it's a 4-byte instruction. + // This can not be true. In this case we can not decide the valid + // previous instruction so we let lldb set the breakpoint at the + // address given by user. inst_to_choose = 0; else // This is straight-forward @@ -2686,8 +2677,8 @@ return; // make sure we check that we are not stopped - // because of us running a user expression - // since in that case we do not want to run the stop-hooks + // because of us running a user expression since in that case we do not want + // to run the stop-hooks if (m_process_sp->GetModIDRef().IsLastResumeForUserExpression()) return; @@ -2976,18 +2967,16 @@ launch_info.GetFlags().Set(eLaunchFlagDebug); // Get the value of synchronous execution here. If you wait till after you - // have started to - // run, then you could have hit a breakpoint, whose command might switch the - // value, and - // then you'll pick up that incorrect value. + // have started to run, then you could have hit a breakpoint, whose command + // might switch the value, and then you'll pick up that incorrect value. Debugger &debugger = GetDebugger(); const bool synchronous_execution = debugger.GetCommandInterpreter().GetSynchronous(); PlatformSP platform_sp(GetPlatform()); - // Finalize the file actions, and if none were given, default to opening - // up a pseudo terminal + // Finalize the file actions, and if none were given, default to opening up a + // pseudo terminal const bool default_to_use_pty = platform_sp ? platform_sp->IsHost() : false; if (log) log->Printf("Target::%s have platform=%s, platform_sp->IsHost()=%s, " @@ -3026,10 +3015,10 @@ GetPlatform()->DebugProcess(launch_info, debugger, this, error); // Cleanup the old process since someone might still have a strong - // reference to this process and we would like to allow it to cleanup - // as much as it can without the object being destroyed. We try to - // lock the shared pointer and if that works, then someone else still - // has a strong reference to the process. + // reference to this process and we would like to allow it to cleanup as + // much as it can without the object being destroyed. We try to lock the + // shared pointer and if that works, then someone else still has a strong + // reference to the process. ProcessSP old_process_sp(process_wp.lock()); if (old_process_sp) @@ -3153,8 +3142,8 @@ const ModuleSP old_exec_module_sp = GetExecutableModule(); - // If no process info was specified, then use the target executable - // name as the process to attach to by default + // If no process info was specified, then use the target executable name as + // the process to attach to by default if (!attach_info.ProcessInfoSpecified()) { if (old_exec_module_sp) attach_info.GetExecutableFile().GetFilename() = @@ -3581,9 +3570,8 @@ bool will_modify, uint32_t idx) const override { // When getting the value for a key from the target options, we will always - // try and grab the setting from the current target if there is one. Else we - // just - // use the one from this instance. + // try and grab the setting from the current target if there is one. Else + // we just use the one from this instance. if (idx == ePropertyEnvVars) GetHostEnvironmentIfNeeded(); @@ -3674,8 +3662,8 @@ m_collection_sp.reset( new TargetOptionValueProperties(target, Target::GetGlobalProperties())); - // Set callbacks to update launch_info whenever "settins set" updated any of - // these properties + // Set callbacks to update launch_info whenever "settins set" updated any + // of these properties m_collection_sp->SetValueChangedCallback( ePropertyArg0, TargetProperties::Arg0ValueChangedCallback, this); m_collection_sp->SetValueChangedCallback( Index: lldb/trunk/source/Target/TargetList.cpp =================================================================== --- lldb/trunk/source/Target/TargetList.cpp +++ lldb/trunk/source/Target/TargetList.cpp @@ -84,9 +84,9 @@ Status error; PlatformSP platform_sp; - // This is purposely left empty unless it is specified by triple_cstr. - // If not initialized via triple_cstr, then the currently selected platform - // will set the architecture correctly. + // This is purposely left empty unless it is specified by triple_cstr. If not + // initialized via triple_cstr, then the currently selected platform will set + // the architecture correctly. const ArchSpec arch(triple_str); if (!triple_str.empty()) { if (!arch.IsValid()) { @@ -123,8 +123,7 @@ module_spec.GetFileSpec().SetFile(user_exe_path, true); // Resolve the executable in case we are given a path to a application - // bundle - // like a .app bundle on MacOSX + // bundle like a .app bundle on MacOSX Host::ResolveExecutableInBundle(module_spec.GetFileSpec()); lldb::offset_t file_offset = 0; @@ -140,7 +139,8 @@ if (platform_arch.IsCompatibleMatch( matching_module_spec.GetArchitecture())) { // If the OS or vendor weren't specified, then adopt the module's - // architecture so that the platform matching can be more accurate + // architecture so that the platform matching can be more + // accurate if (!platform_arch.TripleOSWasSpecified() || !platform_arch.TripleVendorWasSpecified()) { prefer_platform_arch = true; @@ -194,7 +194,8 @@ } } - // Next check the host platform it if wasn't already checked above + // Next check the host platform it if wasn't already checked + // above if (host_platform_sp && (!platform_sp || host_platform_sp->GetName() != platform_sp->GetName())) { @@ -275,8 +276,7 @@ } } else if (platform_arch.IsValid()) { // if "arch" isn't valid, yet "platform_arch" is, it means we have an - // executable file with - // a single architecture which should be used + // executable file with a single architecture which should be used ArchSpec fixed_platform_arch; if (!platform_sp->IsCompatibleArchitecture(platform_arch, false, &fixed_platform_arch)) { @@ -410,8 +410,8 @@ sizeof(resolved_bundle_exe_path)); } } else { - // No file was specified, just create an empty target with any arch - // if a valid arch was specified + // No file was specified, just create an empty target with any arch if a + // valid arch was specified target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target)); } Index: lldb/trunk/source/Target/Thread.cpp =================================================================== --- lldb/trunk/source/Target/Thread.cpp +++ lldb/trunk/source/Target/Thread.cpp @@ -105,9 +105,8 @@ bool will_modify, uint32_t idx) const override { // When getting the value for a key from the thread options, we will always - // try and grab the setting from the current thread if there is one. Else we - // just - // use the one from this instance. + // try and grab the setting from the current thread if there is one. Else + // we just use the one from this instance. if (exe_ctx) { Thread *thread = exe_ctx->GetThreadPtr(); if (thread) { @@ -275,8 +274,8 @@ void Thread::DestroyThread() { // Tell any plans on the plan stacks that the thread is being destroyed since - // any plans that have a thread go away in the middle of might need - // to do cleanup, or in some cases NOT do cleanup... + // any plans that have a thread go away in the middle of might need to do + // cleanup, or in some cases NOT do cleanup... for (auto plan : m_plan_stack) plan->ThreadDestroyed(); @@ -291,11 +290,10 @@ m_discarded_plan_stack.clear(); m_completed_plan_stack.clear(); - // Push a ThreadPlanNull on the plan stack. That way we can continue assuming - // that the - // plan stack is never empty, but if somebody errantly asks questions of a - // destroyed thread - // without checking first whether it is destroyed, they won't crash. + // Push a ThreadPlanNull on the plan stack. That way we can continue + // assuming that the plan stack is never empty, but if somebody errantly asks + // questions of a destroyed thread without checking first whether it is + // destroyed, they won't crash. ThreadPlanSP null_plan_sp(new ThreadPlanNull(*this)); m_plan_stack.push_back(null_plan_sp); @@ -385,11 +383,10 @@ ProcessSP process_sp(GetProcess()); const uint32_t stop_id = process_sp ? process_sp->GetStopID() : UINT32_MAX; - // Here we select the stop info according to priorirty: - // - m_stop_info_sp (if not trace) - preset value - // - completed plan stop info - new value with plan from completed plan stack - // - m_stop_info_sp (trace stop reason is OK now) - // - ask GetPrivateStopInfo to set stop info + // Here we select the stop info according to priorirty: - m_stop_info_sp (if + // not trace) - preset value - completed plan stop info - new value with plan + // from completed plan stack - m_stop_info_sp (trace stop reason is OK now) - + // ask GetPrivateStopInfo to set stop info bool have_valid_stop_info = m_stop_info_sp && m_stop_info_sp ->IsValid() && @@ -432,13 +429,13 @@ } } - // The stop info can be manually set by calling Thread::SetStopInfo() - // prior to this function ever getting called, so we can't rely on - // "m_stop_info_stop_id != process_stop_id" as the condition for - // the if statement below, we must also check the stop info to see - // if we need to override it. See the header documentation in - // Process::GetStopInfoOverrideCallback() for more information on - // the stop info override callback. + // The stop info can be manually set by calling Thread::SetStopInfo() prior + // to this function ever getting called, so we can't rely on + // "m_stop_info_stop_id != process_stop_id" as the condition for the if + // statement below, we must also check the stop info to see if we need to + // override it. See the header documentation in + // Process::GetStopInfoOverrideCallback() for more information on the stop + // info override callback. if (m_stop_info_override_stop_id != process_stop_id) { m_stop_info_override_stop_id = process_stop_id; if (m_stop_info_sp) { @@ -509,9 +506,8 @@ void Thread::SetStopInfoToNothing() { // Note, we can't just NULL out the private reason, or the native thread - // implementation will try to - // go calculate it again. For now, just set it to a Unix Signal with an - // invalid signal number. + // implementation will try to go calculate it again. For now, just set it to + // a Unix Signal with an invalid signal number. SetStopInfo( StopInfo::CreateStopReasonWithSignal(*this, LLDB_INVALID_SIGNAL_NUMBER)); } @@ -604,10 +600,8 @@ void Thread::SetupForResume() { if (GetResumeState() != eStateSuspended) { // If we're at a breakpoint push the step-over breakpoint plan. Do this - // before - // telling the current plan it will resume, since we might change what the - // current - // plan is. + // before telling the current plan it will resume, since we might change + // what the current plan is. lldb::RegisterContextSP reg_ctx_sp(GetRegisterContext()); if (reg_ctx_sp) { @@ -615,9 +609,8 @@ BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(thread_pc); if (bp_site_sp) { - // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target - // may not require anything - // special to step over a breakpoint. + // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the + // target may not require anything special to step over a breakpoint. ThreadPlan *cur_plan = GetCurrentPlan(); @@ -669,11 +662,9 @@ GetPrivateStopInfo(); // This is a little dubious, but we are trying to limit how often we actually - // fetch stop info from - // the target, 'cause that slows down single stepping. So assume that if we - // got to the point where - // we're about to resume, and we haven't yet had to fetch the stop reason, - // then it doesn't need to know + // fetch stop info from the target, 'cause that slows down single stepping. + // So assume that if we got to the point where we're about to resume, and we + // haven't yet had to fetch the stop reason, then it doesn't need to know // about the fact that we are resuming... const uint32_t process_stop_id = GetProcess()->GetStopID(); if (m_stop_info_stop_id == process_stop_id && @@ -684,9 +675,9 @@ } // Tell all the plans that we are about to resume in case they need to clear - // any state. - // We distinguish between the plan on the top of the stack and the lower - // plans in case a plan needs to do any special business before it runs. + // any state. We distinguish between the plan on the top of the stack and the + // lower plans in case a plan needs to do any special business before it + // runs. bool need_to_resume = false; ThreadPlan *plan_ptr = GetCurrentPlan(); @@ -698,8 +689,7 @@ } // If the WillResume for the plan says we are faking a resume, then it will - // have set an appropriate stop info. - // In that case, don't reset it here. + // have set an appropriate stop info. In that case, don't reset it here. if (need_to_resume && resume_state != eStateSuspended) { m_stop_info_sp.reset(); @@ -743,9 +733,8 @@ } // 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 - // stack. + // 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 stack. if (!ThreadStoppedForAReason()) { if (log) log->Printf("Thread::%s for tid = 0x%4.4" PRIx64 " 0x%4.4" PRIx64 @@ -775,10 +764,9 @@ 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. + // "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. StopInfoSP private_stop_info(GetPrivateStopInfo()); if (private_stop_info && !private_stop_info->ShouldStopSynchronous(event_ptr)) { @@ -788,8 +776,8 @@ return false; } - // If we've already been restarted, don't query the plans since the state they - // would examine is not current. + // If we've already been restarted, don't query the plans since the state + // they would examine is not current. if (Process::ProcessEventData::GetRestartedFromEvent(event_ptr)) return false; @@ -798,12 +786,10 @@ GetStackFrameList()->CalculateCurrentInlinedDepth(); // If the base plan doesn't understand why we stopped, then we have to find a - // plan that does. - // If that plan is still working, then we don't need to do any more work. If - // the plan that explains - // the stop is done, then we should pop all the plans below it, and pop it, - // and then let the plans above it decide - // whether they still need to do more work. + // plan that does. If that plan is still working, then we don't need to do + // any more work. If the plan that explains the stop is done, then we should + // pop all the plans below it, and pop it, and then let the plans above it + // decide whether they still need to do more work. bool done_processing_current_plan = false; @@ -812,16 +798,16 @@ done_processing_current_plan = true; should_stop = false; } else { - // If the current plan doesn't explain the stop, then find one that - // does and let it handle the situation. + // If the current plan doesn't explain the stop, then find one that does + // and let it handle the situation. ThreadPlan *plan_ptr = current_plan; while ((plan_ptr = GetPreviousPlan(plan_ptr)) != nullptr) { 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. + // 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 @@ -833,9 +819,9 @@ current_plan->WillStop(); PopPlan(); } while ((current_plan = GetCurrentPlan()) != prev_plan_ptr); - // Now, if the responsible plan was not "Okay to discard" then we're - // done, - // otherwise we forward this to the next plan in the stack below. + // Now, if the responsible plan was not "Okay to discard" then + // we're done, otherwise we forward this to the next plan in the + // stack below. done_processing_current_plan = (plan_ptr->IsMasterPlan() && !plan_ptr->OkayToDiscard()); } else @@ -860,9 +846,9 @@ if (log) log->Printf("Base plan says should stop: %i.", should_stop); } else { - // Otherwise, don't let the base plan override what the other plans say to - // do, since - // presumably if there were other plans they would know what to do... + // Otherwise, don't let the base plan override what the other plans say + // to do, since presumably if there were other plans they would know what + // to do... while (1) { if (PlanIsBasePlan(current_plan)) break; @@ -875,9 +861,8 @@ if (should_stop) current_plan->WillStop(); - // If a Master Plan wants to stop, and wants to stick on the stack, we - // let it. - // Otherwise, see if the plan's parent wants to stop. + // If a Master Plan wants to stop, and wants to stick on the stack, + // we let it. Otherwise, see if the plan's parent wants to stop. if (should_stop && current_plan->IsMasterPlan() && !current_plan->OkayToDiscard()) { @@ -902,18 +887,16 @@ } // One other potential problem is that we set up a master plan, then stop in - // before it is complete - for instance - // 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. + // before it is complete - for instance 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(); - // Discard the stale plans and all plans below them in the stack, - // plus move the completed plans to the completed plan stack + // Discard the stale plans and all plans below them in the stack, plus move + // the completed plans to the completed plan stack while (!PlanIsBasePlan(plan_ptr)) { bool stale = plan_ptr->IsPlanStale(); ThreadPlan *examined_plan = plan_ptr; @@ -928,8 +911,9 @@ DiscardPlan(); } if (examined_plan->IsPlanComplete()) { - // plan is complete but does not explain the stop (example: step to a line - // with breakpoint), let us move the plan to completed_plan_stack anyway + // plan is complete but does not explain the stop (example: step to a + // line with breakpoint), let us move the plan to + // completed_plan_stack anyway PopPlan(); } else DiscardPlan(); @@ -1097,8 +1081,8 @@ } ThreadPlan *Thread::GetCurrentPlan() { - // There will always be at least the base plan. If somebody is mucking with a - // thread with an empty plan stack, we should assert right away. + // There will always be at least the base plan. If somebody is mucking with + // a thread with an empty plan stack, we should assert right away. return m_plan_stack.empty() ? nullptr : m_plan_stack.back().get(); } @@ -1212,8 +1196,7 @@ bool Thread::DiscardUserThreadPlansUpToIndex(uint32_t thread_index) { // Count the user thread plans from the back end to get the number of the one - // we want - // to discard: + // we want to discard: uint32_t idx = 0; ThreadPlan *up_to_plan_ptr = nullptr; @@ -1249,8 +1232,7 @@ int stack_size = m_plan_stack.size(); // If the input plan is nullptr, discard all plans. Otherwise make sure this - // plan is in the - // stack, and if so discard up to and including it. + // plan is in the stack, and if so discard up to and including it. if (up_to_plan_ptr == nullptr) { for (int i = stack_size - 1; i > 0; i--) @@ -1314,8 +1296,7 @@ // Now discard the master plan itself. // The bottom-most plan never gets discarded. "OkayToDiscard" for it - // means - // discard it's dependent plans, but not it... + // means discard it's dependent plans, but not it... if (master_plan_idx > 0) { DiscardPlan(); } @@ -1340,8 +1321,7 @@ int stack_size = m_plan_stack.size(); // If the input plan is nullptr, discard all plans. Otherwise make sure this - // plan is in the - // stack, and if so discard up to and including it. + // plan is in the stack, and if so discard up to and including it. for (int i = stack_size - 1; i > 0; i--) { if (m_plan_stack[i]->GetKind() == ThreadPlan::eKindCallFunction) { @@ -1380,7 +1360,8 @@ return thread_plan_sp; } -// Call the QueueThreadPlanForStepOverRange method which takes an address range. +// Call the QueueThreadPlanForStepOverRange method which takes an address +// range. ThreadPlanSP Thread::QueueThreadPlanForStepOverRange( bool abort_other_plans, const LineEntry &line_entry, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, @@ -1500,11 +1481,9 @@ ThreadPlanSP thread_plan_sp(new ThreadPlanPython(*this, class_name)); QueueThreadPlan(thread_plan_sp, abort_other_plans); // This seems a little funny, but I don't want to have to split up the - // constructor and the - // DidPush in the scripted plan, that seems annoying. - // That means the constructor has to be in DidPush. - // So I have to validate the plan AFTER pushing it, and then take it off - // again... + // constructor and the DidPush in the scripted plan, that seems annoying. + // That means the constructor has to be in DidPush. So I have to validate the + // plan AFTER pushing it, and then take it off again... if (!thread_plan_sp->ValidatePlan(nullptr)) { DiscardThreadPlansUpToPlan(thread_plan_sp); return ThreadPlanSP(); @@ -1701,10 +1680,9 @@ return return_error; } - // Now write the return registers for the chosen frame: - // Note, we can't use ReadAllRegisterValues->WriteAllRegisterValues, since the - // read & write - // cook their data + // Now write the return registers for the chosen frame: Note, we can't use + // ReadAllRegisterValues->WriteAllRegisterValues, since the read & write cook + // their data StackFrameSP youngest_frame_sp = thread->GetStackFrameAtIndex(0); if (youngest_frame_sp) { @@ -1754,13 +1732,11 @@ target->GetImages().FindAddressesForLine(target_sp, file, line, sc.function, within_function, outside_function); - // If possible, we try and stay within the current function. - // Within a function, we accept multiple locations (optimized code may do - // this, - // there's no solution here so we do the best we can). - // However if we're trying to leave the function, we don't know how to pick - // the - // right location, so if there's more than one then we bail. + // If possible, we try and stay within the current function. Within a + // function, we accept multiple locations (optimized code may do this, + // there's no solution here so we do the best we can). However if we're + // trying to leave the function, we don't know how to pick the right + // location, so if there's more than one then we bail. if (!within_function.empty()) candidates = within_function; else if (outside_function.size() == 1 && can_leave_function) @@ -1836,8 +1812,8 @@ addr_t Thread::GetThreadLocalData(const ModuleSP module, lldb::addr_t tls_file_addr) { - // The default implementation is to ask the dynamic loader for it. - // This can be overridden for specific platforms. + // The default implementation is to ask the dynamic loader for it. This can + // be overridden for specific platforms. DynamicLoader *loader = GetProcess()->GetDynamicLoader(); if (loader) return loader->GetThreadLocalData(module, shared_from_this(), @@ -2096,10 +2072,8 @@ bool Thread::IsStillAtLastBreakpointHit() { // If we are currently stopped at a breakpoint, always return that stopinfo - // and don't reset it. - // This allows threads to maintain their breakpoint stopinfo, such as when - // thread-stepping in - // multithreaded programs. + // and don't reset it. This allows threads to maintain their breakpoint + // stopinfo, such as when thread-stepping in multithreaded programs. if (m_stop_info_sp) { StopReason stop_reason = m_stop_info_sp->GetStopReason(); if (stop_reason == lldb::eStopReasonBreakpoint) { Index: lldb/trunk/source/Target/ThreadList.cpp =================================================================== --- lldb/trunk/source/Target/ThreadList.cpp +++ lldb/trunk/source/Target/ThreadList.cpp @@ -40,8 +40,8 @@ const ThreadList &ThreadList::operator=(const ThreadList &rhs) { if (this != &rhs) { - // Lock both mutexes to make sure neither side changes anyone on us - // while the assignment occurs + // Lock both mutexes to make sure neither side changes anyone on us while + // the assignment occurs std::lock_guard guard(GetMutex()); std::lock_guard rhs_guard(rhs.GetMutex()); @@ -54,9 +54,8 @@ } ThreadList::~ThreadList() { - // Clear the thread list. Clear will take the mutex lock - // which will ensure that if anyone is using the list - // they won't get it removed while using it. + // Clear the thread list. Clear will take the mutex lock which will ensure + // that if anyone is using the list they won't get it removed while using it. Clear(); } @@ -231,13 +230,13 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); - // The ShouldStop method of the threads can do a whole lot of work, - // figuring out whether the thread plan conditions are met. So we don't want - // to keep the ThreadList locked the whole time we are doing this. + // The ShouldStop method of the threads can do a whole lot of work, figuring + // out whether the thread plan conditions are met. So we don't want to keep + // the ThreadList locked the whole time we are doing this. // FIXME: It is possible that running code could cause new threads - // to be created. If that happens, we will miss asking them whether - // they should stop. This is not a big deal since we haven't had - // a chance to hang any interesting operations on those threads yet. + // to be created. If that happens, we will miss asking them whether they + // should stop. This is not a big deal since we haven't had a chance to hang + // any interesting operations on those threads yet. collection threads_copy; { @@ -247,25 +246,21 @@ m_process->UpdateThreadListIfNeeded(); for (lldb::ThreadSP thread_sp : m_threads) { // This is an optimization... If we didn't let a thread run in between - // the previous stop and this - // one, we shouldn't have to consult it for ShouldStop. So just leave it - // off the list we are going to - // inspect. - // On Linux, if a thread-specific conditional breakpoint was hit, it won't - // necessarily be the thread - // that hit the breakpoint itself that evaluates the conditional - // expression, so the thread that hit - // the breakpoint could still be asked to stop, even though it hasn't been - // allowed to run since the - // previous stop. + // the previous stop and this one, we shouldn't have to consult it for + // ShouldStop. So just leave it off the list we are going to inspect. On + // Linux, if a thread-specific conditional breakpoint was hit, it won't + // necessarily be the thread that hit the breakpoint itself that + // evaluates the conditional expression, so the thread that hit the + // breakpoint could still be asked to stop, even though it hasn't been + // allowed to run since the previous stop. if (thread_sp->GetTemporaryResumeState() != eStateSuspended || thread_sp->IsStillAtLastBreakpointHit()) threads_copy.push_back(thread_sp); } // It is possible the threads we were allowing to run all exited and then - // maybe the user interrupted - // or something, then fall back on looking at all threads: + // maybe the user interrupted or something, then fall back on looking at + // all threads: if (threads_copy.size() == 0) threads_copy = m_threads; @@ -296,12 +291,11 @@ } // Now we run through all the threads and get their stop info's. We want to - // make sure to do this first before - // we start running the ShouldStop, because one thread's ShouldStop could - // destroy information (like deleting a - // thread specific breakpoint another thread had stopped at) which could lead - // us to compute the StopInfo incorrectly. - // We don't need to use it here, we just want to make sure it gets computed. + // make sure to do this first before we start running the ShouldStop, because + // one thread's ShouldStop could destroy information (like deleting a thread + // specific breakpoint another thread had stopped at) which could lead us to + // compute the StopInfo incorrectly. We don't need to use it here, we just + // want to make sure it gets computed. for (pos = threads_copy.begin(); pos != end; ++pos) { ThreadSP thread_sp(*pos); @@ -312,27 +306,24 @@ ThreadSP thread_sp(*pos); // We should never get a stop for which no thread had a stop reason, but - // sometimes we do see this - - // for instance when we first connect to a remote stub. In that case we - // should stop, since we can't figure out - // the right thing to do and stopping gives the user control over what to do - // in this instance. + // sometimes we do see this - for instance when we first connect to a + // remote stub. In that case we should stop, since we can't figure out the + // right thing to do and stopping gives the user control over what to do in + // this instance. // // Note, this causes a problem when you have a thread specific breakpoint, - // and a bunch of threads hit the breakpoint, - // but not the thread which we are waiting for. All the threads that are - // not "supposed" to hit the breakpoint - // are marked as having no stop reason, which is right, they should not show - // a stop reason. But that triggers this - // code and causes us to stop seemingly for no reason. + // and a bunch of threads hit the breakpoint, but not the thread which we + // are waiting for. All the threads that are not "supposed" to hit the + // breakpoint are marked as having no stop reason, which is right, they + // should not show a stop reason. But that triggers this code and causes + // us to stop seemingly for no reason. // // Since the only way we ever saw this error was on first attach, I'm only - // going to trigger set did_anybody_stop_for_a_reason - // to true unless this is the first stop. + // going to trigger set did_anybody_stop_for_a_reason to true unless this + // is the first stop. // // If this becomes a problem, we'll have to have another StopReason like - // "StopInfoHidden" which will look invalid - // everywhere but at this check. + // "StopInfoHidden" which will look invalid everywhere but at this check. if (thread_sp->GetProcess()->GetStopID() > 1) did_anybody_stop_for_a_reason = true; @@ -379,8 +370,8 @@ log->Printf("ThreadList::%s %" PRIu64 " threads", __FUNCTION__, (uint64_t)m_threads.size()); - // Run through the threads and ask whether we should report this event. - // For stopping, a YES vote wins over everything. A NO vote wins over NO + // Run through the threads and ask whether we should report this event. For + // stopping, a YES vote wins over everything. A NO vote wins over NO // opinion. for (pos = m_threads.begin(); pos != end; ++pos) { ThreadSP thread_sp(*pos); @@ -427,8 +418,8 @@ m_process->UpdateThreadListIfNeeded(); collection::iterator pos, end = m_threads.end(); - // Run through the threads and ask whether we should report this event. - // The rule is NO vote wins over everything, a YES vote wins over no opinion. + // Run through the threads and ask whether we should report this event. The + // rule is NO vote wins over everything, a YES vote wins over no opinion. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); @@ -485,8 +476,8 @@ } void ThreadList::DiscardThreadPlans() { - // You don't need to update the thread list here, because only threads - // that you currently know about have any thread plans. + // You don't need to update the thread list here, because only threads that + // you currently know about have any thread plans. std::lock_guard guard(GetMutex()); collection::iterator pos, end = m_threads.end(); @@ -495,9 +486,9 @@ } bool ThreadList::WillResume() { - // Run through the threads and perform their momentary actions. - // But we only do this for threads that are running, user suspended - // threads stay where they are. + // Run through the threads and perform their momentary actions. But we only + // do this for threads that are running, user suspended threads stay where + // they are. std::lock_guard guard(GetMutex()); m_process->UpdateThreadListIfNeeded(); @@ -505,14 +496,11 @@ collection::iterator pos, end = m_threads.end(); // See if any thread wants to run stopping others. If it does, then we won't - // setup the other threads for resume, since they aren't going to get a chance - // to run. This is necessary because the SetupForResume might add - // "StopOthers" - // plans which would then get to be part of the who-gets-to-run negotiation, - // but - // they're coming in after the fact, and the threads that are already set up - // should - // take priority. + // setup the other threads for resume, since they aren't going to get a + // chance to run. This is necessary because the SetupForResume might add + // "StopOthers" plans which would then get to be part of the who-gets-to-run + // negotiation, but they're coming in after the fact, and the threads that + // are already set up should take priority. bool wants_solo_run = false; @@ -544,11 +532,9 @@ } // Give all the threads that are likely to run a last chance to set up their - // state before we - // negotiate who is actually going to get a chance to run... + // state before we negotiate who is actually going to get a chance to run... // Don't set to resume suspended threads, and if any thread wanted to stop - // others, only - // call setup on the threads that request StopOthers... + // others, only call setup on the threads that request StopOthers... for (pos = m_threads.begin(); pos != end; ++pos) { if ((*pos)->GetResumeState() != eStateSuspended && @@ -650,13 +636,12 @@ std::lock_guard guard(GetMutex()); collection::iterator pos, end = m_threads.end(); for (pos = m_threads.begin(); pos != end; ++pos) { - // Notify threads that the process just stopped. - // Note, this currently assumes that all threads in the list - // stop when the process stops. In the future we will want to support - // a debugging model where some threads continue to run while others - // are stopped. We either need to handle that somehow here or - // create a special thread list containing only threads which will - // stop in the code that calls this method (currently + // Notify threads that the process just stopped. Note, this currently + // assumes that all threads in the list stop when the process stops. In + // the future we will want to support a debugging model where some threads + // continue to run while others are stopped. We either need to handle that + // somehow here or create a special thread list containing only threads + // which will stop in the code that calls this method (currently // Process::SetPrivateState). ThreadSP thread_sp(*pos); if (StateIsRunningState(thread_sp->GetState())) @@ -717,8 +702,8 @@ void ThreadList::Update(ThreadList &rhs) { if (this != &rhs) { - // Lock both mutexes to make sure neither side changes anyone on us - // while the assignment occurs + // Lock both mutexes to make sure neither side changes anyone on us while + // the assignment occurs std::lock_guard guard(GetMutex()); m_process = rhs.m_process; @@ -726,13 +711,12 @@ m_threads.swap(rhs.m_threads); m_selected_tid = rhs.m_selected_tid; - // Now we look for threads that we are done with and - // make sure to clear them up as much as possible so - // anyone with a shared pointer will still have a reference, - // but the thread won't be of much use. Using std::weak_ptr - // for all backward references (such as a thread to a process) - // will eventually solve this issue for us, but for now, we - // need to work around the issue + // Now we look for threads that we are done with and make sure to clear + // them up as much as possible so anyone with a shared pointer will still + // have a reference, but the thread won't be of much use. Using + // std::weak_ptr for all backward references (such as a thread to a + // process) will eventually solve this issue for us, but for now, we need + // to work around the issue collection::iterator rhs_pos, rhs_end = rhs.m_threads.end(); for (rhs_pos = rhs.m_threads.begin(); rhs_pos != rhs_end; ++rhs_pos) { const lldb::tid_t tid = (*rhs_pos)->GetID(); Index: lldb/trunk/source/Target/ThreadPlan.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlan.cpp +++ lldb/trunk/source/Target/ThreadPlan.cpp @@ -100,8 +100,8 @@ } void ThreadPlan::SetStopOthers(bool new_value) { - // SetStopOthers doesn't work up the hierarchy. You have to set the - // explicit ThreadPlan you want to affect. + // SetStopOthers doesn't work up the hierarchy. You have to set the explicit + // ThreadPlan you want to affect. } bool ThreadPlan::WillResume(StateType resume_state, bool current_plan) { Index: lldb/trunk/source/Target/ThreadPlanBase.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanBase.cpp +++ lldb/trunk/source/Target/ThreadPlanBase.cpp @@ -28,8 +28,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// ThreadPlanBase: This one always stops, and never has anything particular -// to do. +// ThreadPlanBase: This one always stops, and never has anything particular to +// do. // FIXME: The "signal handling" policies should probably go here. //---------------------------------------------------------------------- @@ -59,8 +59,8 @@ bool ThreadPlanBase::ValidatePlan(Stream *error) { return true; } bool ThreadPlanBase::DoPlanExplainsStop(Event *event_ptr) { - // The base plan should defer to its tracer, since by default it - // always handles the stop. + // The base plan should defer to its tracer, since by default it always + // handles the stop. if (TracerExplainsStop()) return false; else @@ -99,10 +99,9 @@ case eStopReasonBreakpoint: case eStopReasonWatchpoint: if (stop_info_sp->ShouldStopSynchronous(event_ptr)) { - // If we are going to stop for a breakpoint, then unship the other plans - // at this point. Don't force the discard, however, so Master plans can - // stay - // in place if they want to. + // If we are going to stop for a breakpoint, then unship the other + // plans at this point. Don't force the discard, however, so Master + // plans can stay in place if they want to. if (log) log->Printf( "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64 @@ -112,9 +111,8 @@ return true; } // If we aren't going to stop at this breakpoint, and it is internal, - // don't report this stop or the subsequent running event. - // Otherwise we will post the stopped & running, but the stopped event - // will get marked + // don't report this stop or the subsequent running event. Otherwise we + // will post the stopped & running, but the stopped event will get marked // with "restarted" so the UI will know to wait and expect the consequent // "running". if (stop_info_sp->ShouldNotify(event_ptr)) { @@ -131,10 +129,9 @@ break; case eStopReasonException: - // If we crashed, discard thread plans and stop. Don't force the discard, - // however, - // since on rerun the target may clean up this exception and continue - // normally from there. + // If we crashed, discard thread plans and stop. Don't force the + // discard, however, since on rerun the target may clean up this + // exception and continue normally from there. if (log) log->Printf( "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64 @@ -144,10 +141,9 @@ return true; case eStopReasonExec: - // If we crashed, discard thread plans and stop. Don't force the discard, - // however, - // since on rerun the target may clean up this exception and continue - // normally from there. + // If we crashed, discard thread plans and stop. Don't force the + // discard, however, since on rerun the target may clean up this + // exception and continue normally from there. if (log) log->Printf( "Base plan discarding thread plans for thread tid = 0x%4.4" PRIx64 @@ -198,8 +194,7 @@ bool ThreadPlanBase::DoWillResume(lldb::StateType resume_state, bool current_plan) { // Reset these to the default values so we don't set them wrong, then not get - // asked - // for a while, then return the wrong answer. + // asked for a while, then return the wrong answer. m_run_vote = eVoteNoOpinion; m_stop_vote = eVoteNo; return true; Index: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp +++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp @@ -56,8 +56,7 @@ 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... + // to put our function, we're not going to get any further... Status error; process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error); if (!error.Success()) { @@ -278,9 +277,8 @@ LIBLLDB_LOG_PROCESS)); m_real_stop_info_sp = GetPrivateStopInfo(); - // If our subplan knows why we stopped, even if it's done (which would forward - // the question to us) - // we answer yes. + // If our subplan knows why we stopped, even if it's done (which would + // forward the question to us) we answer yes. if (m_subplan_sp && m_subplan_sp->PlanExplainsStop(event_ptr)) { SetPlanComplete(); return true; @@ -302,8 +300,8 @@ return true; // One more quirk here. If this event was from Halt interrupting the target, - // then we should not consider - // ourselves complete. Return true to acknowledge the stop. + // then we should not consider ourselves complete. Return true to + // acknowledge the stop. if (Process::ProcessEventData::GetInterruptedFromEvent(event_ptr)) { if (log) log->Printf("ThreadPlanCallFunction::PlanExplainsStop: The event is an " @@ -312,8 +310,8 @@ } // We control breakpoints separately from other "stop reasons." So first, // check the case where we stopped for an internal breakpoint, in that case, - // continue on. - // If it is not an internal breakpoint, consult m_ignore_breakpoints. + // continue on. If it is not an internal breakpoint, consult + // m_ignore_breakpoints. if (stop_reason == eStopReasonBreakpoint) { ProcessSP process_sp(m_thread.CalculateProcess()); @@ -364,15 +362,13 @@ // should be propagated up the stack. return false; } else { - // If the subplan is running, any crashes are attributable to us. - // If we want to discard the plan, then we say we explain the stop - // but if we are going to be discarded, let whoever is above us - // explain the stop. - // But don't discard the plan if the stop would restart itself (for instance - // if it is a - // signal that is set not to stop. Check that here first. We just say we - // explain the stop - // but aren't done and everything will continue on from there. + // If the subplan is running, any crashes are attributable to us. If we + // want to discard the plan, then we say we explain the stop but if we are + // going to be discarded, let whoever is above us explain the stop. But + // don't discard the plan if the stop would restart itself (for instance if + // it is a signal that is set not to stop. Check that here first. We just + // say we explain the stop but aren't done and everything will continue on + // from there. if (m_real_stop_info_sp && m_real_stop_info_sp->ShouldStopSynchronous(event_ptr)) { @@ -385,8 +381,8 @@ bool ThreadPlanCallFunction::ShouldStop(Event *event_ptr) { // We do some computation in DoPlanExplainsStop that may or may not set the - // plan as complete. - // We need to do that here to make sure our state is correct. + // plan as complete. We need to do that here to make sure our state is + // correct. DoPlanExplainsStop(event_ptr); if (IsPlanComplete()) { @@ -405,9 +401,8 @@ //#define SINGLE_STEP_EXPRESSIONS // Now set the thread state to "no reason" so we don't run with whatever - // signal was outstanding... - // Wait till the plan is pushed so we aren't changing the stop info till we're - // about to run. + // signal was outstanding... Wait till the plan is pushed so we aren't + // changing the stop info till we're about to run. GetThread().SetStopInfoToNothing(); @@ -483,10 +478,9 @@ SetPlanComplete(false); - // If the user has set the ObjC language breakpoint, it would normally get - // priority over our internal - // catcher breakpoint, but in this case we can't let that happen, so force - // the ShouldStop here. + // If the user has set the ObjC language breakpoint, it would normally + // get priority over our internal catcher breakpoint, but in this case we + // can't let that happen, so force the ShouldStop here. stop_info_sp->OverrideShouldStop(true); return true; } Index: lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp +++ lldb/trunk/source/Target/ThreadPlanCallOnFunctionExit.cpp @@ -23,8 +23,8 @@ } void ThreadPlanCallOnFunctionExit::DidPush() { - // We now want to queue the "step out" thread plan so it executes - // and completes. + // We now want to queue the "step out" thread plan so it executes and + // completes. // Set stop vote to eVoteNo. m_step_out_threadplan_sp = GetThread().QueueThreadPlanForStepOut( @@ -59,9 +59,9 @@ } bool ThreadPlanCallOnFunctionExit::ShouldStop(Event *event_ptr) { - // If this is where we find out that an internal stop came in, then: - // Check if the step-out plan completed. If it did, then we want to - // run the callback here (our reason for living...) + // If this is where we find out that an internal stop came in, then: Check if + // the step-out plan completed. If it did, then we want to run the callback + // here (our reason for living...) if (m_step_out_threadplan_sp && m_step_out_threadplan_sp->IsPlanComplete()) { m_callback(); @@ -71,8 +71,8 @@ // Indicate that this plan is done and can be discarded. SetPlanComplete(); - // We're done now, but we want to return false so that we - // don't cause the thread to really stop. + // We're done now, but we want to return false so that we don't cause the + // thread to really stop. } return false; @@ -80,21 +80,20 @@ bool ThreadPlanCallOnFunctionExit::WillStop() { // The code looks like the return value is ignored via ThreadList:: - // ShouldStop(). - // This is called when we really are going to stop. We don't care - // and don't need to do anything here. + // ShouldStop(). This is called when we really are going to stop. We don't + // care and don't need to do anything here. return false; } bool ThreadPlanCallOnFunctionExit::DoPlanExplainsStop(Event *event_ptr) { - // We don't ever explain a stop. The only stop that is relevant - // to us directly is the step_out plan we added to do the heavy lifting - // of getting us past the current method. + // We don't ever explain a stop. The only stop that is relevant to us + // directly is the step_out plan we added to do the heavy lifting of getting + // us past the current method. return false; } lldb::StateType ThreadPlanCallOnFunctionExit::GetPlanRunState() { - // This value doesn't matter - we'll never be the top thread plan, so - // nobody will ask us this question. + // This value doesn't matter - we'll never be the top thread plan, so nobody + // will ask us this question. return eStateRunning; } Index: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp +++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp @@ -44,8 +44,8 @@ lldb::UserExpressionSP &user_expression_sp) : ThreadPlanCallFunction(thread, function, CompilerType(), args, options), m_user_expression_sp(user_expression_sp) { - // User expressions are generally "User generated" so we should set them up to - // stop when done. + // User expressions are generally "User generated" so we should set them up + // to stop when done. SetIsMasterPlan(true); SetOkayToDiscard(false); } Index: lldb/trunk/source/Target/ThreadPlanPython.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanPython.cpp +++ lldb/trunk/source/Target/ThreadPlanPython.cpp @@ -59,8 +59,7 @@ void ThreadPlanPython::DidPush() { // We set up the script side in DidPush, so that it can push other plans in - // the constructor, - // and doesn't have to care about the details of DidPush. + // the constructor, and doesn't have to care about the details of DidPush. if (!m_class_name.empty()) { ScriptInterpreter *script_interp = m_thread.GetProcess() Index: lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp +++ lldb/trunk/source/Target/ThreadPlanRunToAddress.cpp @@ -133,8 +133,7 @@ } bool ThreadPlanRunToAddress::ValidatePlan(Stream *error) { - // If we couldn't set the breakpoint for some reason, then this won't - // work. + // If we couldn't set the breakpoint for some reason, then this won't work. bool all_bps_good = true; size_t num_break_ids = m_break_ids.size(); Index: lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp +++ lldb/trunk/source/Target/ThreadPlanShouldStopHere.cpp @@ -86,8 +86,8 @@ // Always avoid code with line number 0. // FIXME: At present the ShouldStop and the StepFromHere calculate this // independently. If this ever - // becomes expensive (this one isn't) we can try to have this set a state that - // the StepFromHere can use. + // becomes expensive (this one isn't) we can try to have this set a state + // that the StepFromHere can use. if (frame) { SymbolContext sc; sc = frame->GetSymbolContext(eSymbolContextLineEntry); @@ -104,9 +104,8 @@ const bool stop_others = false; const size_t frame_index = 0; ThreadPlanSP return_plan_sp; - // If we are stepping through code at line number 0, then we need to step over - // this range. Otherwise - // we will step out. + // If we are stepping through code at line number 0, then we need to step + // over this range. Otherwise we will step out. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); @@ -119,8 +118,7 @@ AddressRange range = sc.line_entry.range; // If the whole function is marked line 0 just step out, that's easier & - // faster than continuing - // to step through it. + // faster than continuing to step through it. bool just_step_out = false; if (sc.symbol && sc.symbol->ValueIsAddress()) { Address symbol_end = sc.symbol->GetAddress(); Index: lldb/trunk/source/Target/ThreadPlanStepInRange.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInRange.cpp +++ lldb/trunk/source/Target/ThreadPlanStepInRange.cpp @@ -35,8 +35,7 @@ //---------------------------------------------------------------------- // ThreadPlanStepInRange: Step through a stack range, either stepping over or -// into -// based on the value of \a type. +// into based on the value of \a type. //---------------------------------------------------------------------- ThreadPlanStepInRange::ThreadPlanStepInRange( @@ -164,15 +163,14 @@ if (m_virtual_step) { // If we've just completed a virtual step, all we need to do is check for a - // ShouldStopHere plan, and otherwise - // we're done. + // ShouldStopHere plan, and otherwise we're done. // FIXME - This can be both a step in and a step out. Probably should // record which in the m_virtual_step. m_sub_plan_sp = CheckShouldStopHereAndQueueStepOut(eFrameCompareYounger); } else { // Stepping through should be done running other threads in general, since - // we're setting a breakpoint and - // continuing. So only stop others if we are explicitly told to do so. + // we're setting a breakpoint and continuing. So only stop others if we + // are explicitly told to do so. bool stop_others = (m_stop_others == lldb::eOnlyThisThread); @@ -185,9 +183,8 @@ // A caveat to this is if we think the frame is older but we're actually // in a trampoline. // I'm going to make the assumption that you wouldn't RETURN to a - // trampoline. So if we are - // in a trampoline we think the frame is older because the trampoline - // confused the backtracer. + // trampoline. So if we are in a trampoline we think the frame is older + // because the trampoline confused the backtracer. m_sub_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others); if (!m_sub_plan_sp) { @@ -204,19 +201,15 @@ "Thought I stepped out, but in fact arrived at a trampoline."); } } else if (frame_order == eFrameCompareEqual && InSymbol()) { - // If we are not in a place we should step through, we're done. - // One tricky bit here is that some stubs don't push a frame, so we have - // to check - // both the case of a frame that is younger, or the same as this frame. - // However, if the frame is the same, and we are still in the symbol we - // started - // in, the we don't need to do this. This first check isn't strictly - // necessary, - // but it is more efficient. + // If we are not in a place we should step through, we're done. One + // tricky bit here is that some stubs don't push a frame, so we have to + // check both the case of a frame that is younger, or the same as this + // frame. However, if the frame is the same, and we are still in the + // symbol we started in, the we don't need to do this. This first check + // isn't strictly necessary, but it is more efficient. // If we're still in the range, keep going, either by running to the next - // branch breakpoint, or by - // stepping. + // branch breakpoint, or by stepping. if (InRange()) { SetNextBranchBreakpoint(); return false; @@ -244,15 +237,13 @@ log->Printf("No step through plan found."); } - // If not, give the "should_stop" callback a chance to push a plan to get us - // out of here. - // But only do that if we actually have stepped in. + // If not, give the "should_stop" callback a chance to push a plan to get + // us out of here. But only do that if we actually have stepped in. if (!m_sub_plan_sp && frame_order == eFrameCompareYounger) m_sub_plan_sp = CheckShouldStopHereAndQueueStepOut(frame_order); // If we've stepped in and we are going to stop here, check to see if we - // were asked to - // run past the prologue, and if so do that. + // were asked to run past the prologue, and if so do that. if (!m_sub_plan_sp && frame_order == eFrameCompareYounger && m_step_past_prologue) { @@ -413,8 +404,8 @@ SymbolContext sc = frame->GetSymbolContext( eSymbolContextFunction | eSymbolContextBlock | eSymbolContextSymbol); if (sc.symbol != nullptr) { - // First try an exact match, since that's cheap with ConstStrings. Then - // do a strstr compare. + // First try an exact match, since that's cheap with ConstStrings. + // Then do a strstr compare. if (step_in_range_plan->m_step_into_target == sc.GetFunctionName()) { should_stop_here = true; } else { @@ -449,25 +440,19 @@ bool ThreadPlanStepInRange::DoPlanExplainsStop(Event *event_ptr) { // We always explain a stop. Either we've just done a single step, in which - // case we'll do our ordinary processing, or we stopped for some - // reason that isn't handled by our sub-plans, in which case we want to just - // stop right - // away. - // In general, we don't want to mark the plan as complete for unexplained - // stops. - // For instance, if you step in to some code with no debug info, so you step - // out - // and in the course of that hit a breakpoint, then you want to stop & show - // the user - // the breakpoint, but not unship the step in plan, since you still may want - // to complete that - // plan when you continue. This is particularly true when doing "step in to - // target function." + // case we'll do our ordinary processing, or we stopped for some reason that + // isn't handled by our sub-plans, in which case we want to just stop right + // away. In general, we don't want to mark the plan as complete for + // unexplained stops. For instance, if you step in to some code with no debug + // info, so you step out and in the course of that hit a breakpoint, then you + // want to stop & show the user the breakpoint, but not unship the step in + // plan, since you still may want to complete that plan when you continue. + // This is particularly true when doing "step in to target function." // stepping. // - // The only variation is that if we are doing "step by running to next branch" - // in which case - // if we hit our branch breakpoint we don't set the plan to complete. + // The only variation is that if we are doing "step by running to next + // branch" in which case if we hit our branch breakpoint we don't set the + // plan to complete. bool return_value = false; Index: lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp +++ lldb/trunk/source/Target/ThreadPlanStepInstruction.cpp @@ -76,8 +76,8 @@ } bool ThreadPlanStepInstruction::ValidatePlan(Stream *error) { - // Since we read the instruction we're stepping over from the thread, - // this plan will always work. + // Since we read the instruction we're stepping over from the thread, this + // plan will always work. return true; } @@ -106,8 +106,8 @@ return (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr); } else if (cur_frame_id < m_stack_id) { // If the current frame is younger than the start frame and we are stepping - // over, then we need to continue, - // but if we are doing just one step, we're done. + // over, then we need to continue, but if we are doing just one step, we're + // done. return !m_step_over; } else { if (log) { @@ -140,8 +140,7 @@ return true; } else { // We are still stepping, reset the start pc, and in case we've - // stepped out, - // reset the current stack id. + // stepped out, reset the current stack id. SetUpState(); return false; } @@ -154,9 +153,8 @@ if (return_frame->GetStackID() != m_parent_frame_id || m_start_has_symbol) { // next-instruction shouldn't step out of inlined functions. But we - // may have stepped into a - // real function that starts with an inlined function, and we do want - // to step out of that... + // may have stepped into a real function that starts with an inlined + // function, and we do want to step out of that... if (cur_frame_sp->IsInlined()) { StackFrameSP parent_frame_sp = @@ -190,9 +188,8 @@ log->Printf("%s.", s.GetData()); } - // StepInstruction should probably have the tri-state RunMode, but for - // now it is safer to - // run others. + // StepInstruction should probably have the tri-state RunMode, but + // for now it is safer to run others. const bool stop_others = false; m_thread.QueueThreadPlanForStepOutNoShouldStop( false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion, 0); @@ -222,8 +219,7 @@ return true; } else { // We are still stepping, reset the start pc, and in case we've stepped - // in or out, - // reset the current stack id. + // in or out, reset the current stack id. SetUpState(); return false; } Index: lldb/trunk/source/Target/ThreadPlanStepOut.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOut.cpp +++ lldb/trunk/source/Target/ThreadPlanStepOut.cpp @@ -63,17 +63,14 @@ m_step_out_to_id = return_frame_sp->GetStackID(); m_immediate_step_from_id = immediate_return_from_sp->GetStackID(); - // If the frame directly below the one we are returning to is inlined, we have - // to be - // a little more careful. It is non-trivial to determine the real "return - // code address" for - // an inlined frame, so we have to work our way to that frame and then step - // out. + // If the frame directly below the one we are returning to is inlined, we + // have to be a little more careful. It is non-trivial to determine the real + // "return code address" for an inlined frame, so we have to work our way to + // that frame and then step out. if (immediate_return_from_sp && immediate_return_from_sp->IsInlined()) { if (frame_idx > 0) { // First queue a plan that gets us to this inlined frame, and when we get - // there we'll queue a second - // plan that walks us out of this frame. + // there we'll queue a second plan that walks us out of this frame. m_step_out_to_inline_plan_sp.reset(new ThreadPlanStepOut( m_thread, nullptr, false, stop_others, eVoteNoOpinion, eVoteNoOpinion, frame_idx - 1, eLazyBoolNo, continue_to_next_branch)); @@ -81,8 +78,8 @@ ->SetShouldStopHereCallbacks(nullptr, nullptr); m_step_out_to_inline_plan_sp->SetPrivate(true); } else { - // If we're already at the inlined frame we're stepping through, then just - // do that now. + // If we're already at the inlined frame we're stepping through, then + // just do that now. QueueInlinedStepPlan(false); } } else if (return_frame_sp) { @@ -217,8 +214,8 @@ } bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) { - // If the step out plan is done, then we just need to step through the inlined - // frame. + // If the step out plan is done, then we just need to step through the + // inlined frame. if (m_step_out_to_inline_plan_sp) { return m_step_out_to_inline_plan_sp->MischiefManaged(); } else if (m_step_through_inline_plan_sp) { @@ -233,15 +230,14 @@ } // We don't explain signals or breakpoints (breakpoints that handle stepping - // in or - // out will be handled by a child plan. + // in or out will be handled by a child plan. StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (stop_info_sp) { StopReason reason = stop_info_sp->GetStopReason(); if (reason == eStopReasonBreakpoint) { - // If this is OUR breakpoint, we're fine, otherwise we don't know why this - // happened... + // If this is OUR breakpoint, we're fine, otherwise we don't know why + // this happened... BreakpointSiteSP site_sp( m_thread.GetProcess()->GetBreakpointSiteList().FindByID( stop_info_sp->GetValue())); @@ -268,11 +264,10 @@ } // If there was only one owner, then we're done. But if we also hit - // some - // user breakpoint on our way out, we should mark ourselves as done, but - // also not claim to explain the stop, since it is more important to - // report - // the user breakpoint than the step out completion. + // some user breakpoint on our way out, we should mark ourselves as + // done, but also not claim to explain the stop, since it is more + // important to report the user breakpoint than the step out + // completion. if (site_sp->GetNumberOfOwners() == 1) return true; @@ -320,9 +315,8 @@ done = !(frame_zero_id < m_step_out_to_id); } - // The normal step out computations think we are done, so all we need to do is - // consult the ShouldStopHere, - // and we are done. + // The normal step out computations think we are done, so all we need to do + // is consult the ShouldStopHere, and we are done. if (done) { if (InvokeShouldStopHereCallback(eFrameCompareOlder)) { @@ -377,8 +371,7 @@ // I also check the stack depth, since if we've blown past the breakpoint // for some // reason and we're now stopping for some other reason altogether, then - // we're done - // with this step out operation. + // we're done with this step out operation. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); if (log) @@ -397,10 +390,8 @@ bool ThreadPlanStepOut::QueueInlinedStepPlan(bool queue_now) { // Now figure out the range of this inlined block, and set up a "step through - // range" - // plan for that. If we've been provided with a context, then use the block - // in that - // context. + // range" plan for that. If we've been provided with a context, then use the + // block in that context. StackFrameSP immediate_return_from_sp(m_thread.GetStackFrameAtIndex(0)); if (!immediate_return_from_sp) return false; @@ -477,8 +468,8 @@ } bool ThreadPlanStepOut::IsPlanStale() { - // If we are still lower on the stack than the frame we are returning to, then - // there's something for us to do. Otherwise, we're stale. + // If we are still lower on the stack than the frame we are returning to, + // then there's something for us to do. Otherwise, we're stale. StackID frame_zero_id = m_thread.GetStackFrameAtIndex(0)->GetStackID(); return !(frame_zero_id < m_step_out_to_id); Index: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp +++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp @@ -31,8 +31,8 @@ ThreadPlan::eKindStepOverBreakpoint, "Step over breakpoint trap", thread, eVoteNo, eVoteNoOpinion), // We need to report the run since this happens - // first in the thread plan stack when stepping - // over a breakpoint + // first in the thread plan stack when stepping over + // a breakpoint m_breakpoint_addr(LLDB_INVALID_ADDRESS), m_auto_continue(false), m_reenabled_breakpoint_site(false) @@ -57,16 +57,15 @@ StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (stop_info_sp) { // It's a little surprising that we stop here for a breakpoint hit. - // However, when you single step ONTO a breakpoint - // we still want to call that a breakpoint hit, and trigger the actions, - // etc. Otherwise you would see the + // However, when you single step ONTO a breakpoint we still want to call + // that a breakpoint hit, and trigger the actions, etc. Otherwise you + // would see the // PC at the breakpoint without having triggered the actions, then you'd // continue, the PC wouldn't change, - // and you'd see the breakpoint hit, which would be odd. - // So the lower levels fake "step onto breakpoint address" and return that - // as a breakpoint. So our trace - // step COULD appear as a breakpoint hit if the next instruction also - // contained a breakpoint. + // and you'd see the breakpoint hit, which would be odd. So the lower + // levels fake "step onto breakpoint address" and return that as a + // breakpoint. So our trace step COULD appear as a breakpoint hit if the + // next instruction also contained a breakpoint. StopReason reason = stop_info_sp->GetStopReason(); switch (reason) { @@ -75,20 +74,17 @@ return true; case eStopReasonBreakpoint: // It's a little surprising that we stop here for a breakpoint hit. - // However, when you single step ONTO a - // breakpoint we still want to call that a breakpoint hit, and trigger the - // actions, etc. Otherwise you + // However, when you single step ONTO a breakpoint we still want to call + // that a breakpoint hit, and trigger the actions, etc. Otherwise you // would see the PC at the breakpoint without having triggered the - // actions, then you'd continue, the PC - // wouldn't change, and you'd see the breakpoint hit, which would be odd. - // So the lower levels fake "step onto breakpoint address" and return that - // as a breakpoint hit. So our trace - // step COULD appear as a breakpoint hit if the next instruction also - // contained a breakpoint. We don't want - // to handle that, since we really don't know what to do with breakpoint - // hits. But make sure we don't set - // ourselves to auto-continue or we'll wrench control away from the plans - // that can deal with this. + // actions, then you'd continue, the PC wouldn't change, and you'd see + // the breakpoint hit, which would be odd. So the lower levels fake "step + // onto breakpoint address" and return that as a breakpoint hit. So our + // trace step COULD appear as a breakpoint hit if the next instruction + // also contained a breakpoint. We don't want to handle that, since we + // really don't know what to do with breakpoint hits. But make sure we + // don't set ourselves to auto-continue or we'll wrench control away from + // the plans that can deal with this. SetAutoContinue(false); return false; default: @@ -130,8 +126,7 @@ if (pc_addr == m_breakpoint_addr) { // If we are still at the PC of our breakpoint, then for some reason we - // didn't - // get a chance to run. + // didn't get a chance to run. return false; } else { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Index: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp +++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp @@ -32,8 +32,7 @@ //---------------------------------------------------------------------- // ThreadPlanStepOverRange: Step through a stack range, either stepping over or -// into -// based on the value of \a type. +// into based on the value of \a type. //---------------------------------------------------------------------- ThreadPlanStepOverRange::ThreadPlanStepOverRange( @@ -91,21 +90,17 @@ else GetFlags().Clear(ThreadPlanShouldStopHere::eStepOutAvoidNoDebug); // Step Over plans should always avoid no-debug on step in. Seems like you - // shouldn't - // have to say this, but a tail call looks more like a step in that a step - // out, so - // we want to catch this case. + // shouldn't have to say this, but a tail call looks more like a step in that + // a step out, so we want to catch this case. GetFlags().Set(ThreadPlanShouldStopHere::eStepInAvoidNoDebug); } bool ThreadPlanStepOverRange::IsEquivalentContext( const SymbolContext &context) { - // Match as much as is specified in the m_addr_context: - // This is a fairly loose sanity check. Note, sometimes the target doesn't - // get filled - // in so I left out the target check. And sometimes the module comes in as - // the .o file from the - // inlined range, so I left that out too... + // Match as much as is specified in the m_addr_context: This is a fairly + // loose sanity check. Note, sometimes the target doesn't get filled in so I + // left out the target check. And sometimes the module comes in as the .o + // file from the inlined range, so I left that out too... if (m_addr_context.comp_unit) { if (m_addr_context.comp_unit != context.comp_unit) return false; @@ -113,8 +108,8 @@ if (m_addr_context.function != context.function) return false; // It is okay to return to a different block of a straight function, we - // only have to - // be more careful if returning from one inlined block to another. + // only have to be more careful if returning from one inlined block to + // another. if (m_addr_context.block->GetInlinedFunctionInfo() == nullptr && context.block->GetInlinedFunctionInfo() == nullptr) return true; @@ -140,8 +135,8 @@ } // If we're out of the range but in the same frame or in our caller's frame - // then we should stop. - // When stepping out we only stop others if we are forcing running one thread. + // then we should stop. When stepping out we only stop others if we are + // forcing running one thread. bool stop_others = (m_stop_others == lldb::eOnlyThisThread); ThreadPlanSP new_plan_sp; FrameComparison frame_order = CompareCurrentFrameToStartFrame(); @@ -152,11 +147,9 @@ // A caveat to this is if we think the frame is older but we're actually in // a trampoline. // I'm going to make the assumption that you wouldn't RETURN to a - // trampoline. So if we are - // in a trampoline we think the frame is older because the trampoline - // confused the backtracer. - // As below, we step through first, and then try to figure out how to get - // back out again. + // trampoline. So if we are in a trampoline we think the frame is older + // because the trampoline confused the backtracer. As below, we step + // through first, and then try to figure out how to get back out again. new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others); @@ -166,8 +159,7 @@ "Thought I stepped out, but in fact arrived at a trampoline."); } else if (frame_order == eFrameCompareYounger) { // Make sure we really are in a new frame. Do that by unwinding and seeing - // if the - // start function really is our start function... + // if the start function really is our start function... for (uint32_t i = 1;; ++i) { StackFrameSP older_frame_sp = m_thread.GetStackFrameAtIndex(i); if (!older_frame_sp) { @@ -200,28 +192,23 @@ if (!InSymbol()) { // This one is a little tricky. Sometimes we may be in a stub or - // something similar, - // in which case we need to get out of there. But if we are in a stub - // then it's - // likely going to be hard to get out from here. It is probably easiest - // to step into the - // stub, and then it will be straight-forward to step out. + // something similar, in which case we need to get out of there. But if + // we are in a stub then it's likely going to be hard to get out from + // here. It is probably easiest to step into the stub, and then it will + // be straight-forward to step out. new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others); } else { - // The current clang (at least through 424) doesn't always get the address - // range for the - // DW_TAG_inlined_subroutines right, so that when you leave the inlined - // range the line table says - // you are still in the source file of the inlining function. This is - // bad, because now you are missing - // the stack frame for the function containing the inlining, and if you - // sensibly do "finish" to get - // out of this function you will instead exit the containing function. - // To work around this, we check whether we are still in the source file - // we started in, and if not assume - // it is an error, and push a plan to get us out of this line and back to - // the containing file. + // The current clang (at least through 424) doesn't always get the + // address range for the DW_TAG_inlined_subroutines right, so that when + // you leave the inlined range the line table says you are still in the + // source file of the inlining function. This is bad, because now you + // are missing the stack frame for the function containing the inlining, + // and if you sensibly do "finish" to get out of this function you will + // instead exit the containing function. To work around this, we check + // whether we are still in the source file we started in, and if not + // assume it is an error, and push a plan to get us out of this line and + // back to the containing file. if (m_addr_context.line_entry.IsValid()) { SymbolContext sc; @@ -244,14 +231,11 @@ bool step_past_remaining_inline = false; if (entry_idx > 0) { // We require the previous line entry and the current line - // entry come - // from the same file. - // The other requirement is that the previous line table entry - // be part of an - // inlined block, we don't want to step past cases where - // people have inlined - // some code fragment by using #include - // directly. + // entry come from the same file. The other requirement is + // that the previous line table entry be part of an inlined + // block, we don't want to step past cases where people have + // inlined some code fragment by using #include directly. LineEntry prev_line_entry; if (line_table->GetLineEntryAtIndex(entry_idx - 1, prev_line_entry) && @@ -338,8 +322,7 @@ if (!new_plan_sp) { // For efficiencies sake, we know we're done here so we don't have to do - // this - // calculation again in MischiefManaged. + // this calculation again in MischiefManaged. SetPlanComplete(); return true; } else @@ -347,16 +330,12 @@ } bool ThreadPlanStepOverRange::DoPlanExplainsStop(Event *event_ptr) { - // For crashes, breakpoint hits, signals, etc, let the base plan (or some plan - // above us) - // handle the stop. That way the user can see the stop, step around, and then - // when they - // are done, continue and have their step complete. The exception is if we've - // hit our - // "run to next branch" breakpoint. - // Note, unlike the step in range plan, we don't mark ourselves complete if we - // hit an - // unexplained breakpoint/crash. + // For crashes, breakpoint hits, signals, etc, let the base plan (or some + // plan above us) handle the stop. That way the user can see the stop, step + // around, and then when they are done, continue and have their step + // complete. The exception is if we've hit our "run to next branch" + // breakpoint. Note, unlike the step in range plan, we don't mark ourselves + // complete if we hit an unexplained breakpoint/crash. Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); StopInfoSP stop_info_sp = GetPrivateStopInfo(); @@ -387,8 +366,8 @@ m_first_resume = false; if (resume_state == eStateStepping && current_plan) { // See if we are about to step over an inlined call in the middle of the - // inlined stack, if so figure - // out its extents and reset our range to step over that. + // inlined stack, if so figure out its extents and reset our range to + // step over that. bool in_inlined_stack = m_thread.DecrementCurrentInlinedDepth(); if (in_inlined_stack) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); Index: lldb/trunk/source/Target/ThreadPlanStepRange.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepRange.cpp +++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp @@ -31,8 +31,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- -// ThreadPlanStepRange: Step through a stack range, either stepping over or into -// based on the value of \a type. +// ThreadPlanStepRange: Step through a stack range, either stepping over or +// into based on the value of \a type. //---------------------------------------------------------------------- ThreadPlanStepRange::ThreadPlanStepRange(ThreadPlanKind kind, const char *name, @@ -74,15 +74,14 @@ } void ThreadPlanStepRange::AddRange(const AddressRange &new_range) { - // For now I'm just adding the ranges. At some point we may want to - // condense the ranges if they overlap, though I don't think it is likely - // to be very important. + // For now I'm just adding the ranges. At some point we may want to condense + // the ranges if they overlap, though I don't think it is likely to be very + // important. m_address_ranges.push_back(new_range); // Fill the slot for this address range with an empty DisassemblerSP in the - // instruction ranges. I want the - // indices to match, but I don't want to do the work to disassemble this range - // if I don't step into it. + // instruction ranges. I want the indices to match, but I don't want to do + // the work to disassemble this range if I don't step into it. m_instruction_ranges.push_back(DisassemblerSP()); } @@ -158,12 +157,11 @@ } else if (new_context.line_entry.range.GetBaseAddress().GetLoadAddress( m_thread.CalculateTarget().get()) != pc_load_addr) { // Another thing that sometimes happens here is that we step out of - // one line into the MIDDLE of another - // line. So far I mostly see this due to bugs in the debug - // information. - // But we probably don't want to be in the middle of a line range, so - // in that case reset the stepping - // range to the line we've stepped into the middle of and continue. + // one line into the MIDDLE of another line. So far I mostly see + // this due to bugs in the debug information. But we probably don't + // want to be in the middle of a line range, so in that case reset + // the stepping range to the line we've stepped into the middle of + // and continue. m_addr_context = new_context; m_address_ranges.clear(); AddRange(m_addr_context.line_entry.range); @@ -260,9 +258,8 @@ return nullptr; else { // Find where we are in the instruction list as well. If we aren't at - // an instruction, - // return nullptr. In this case, we're probably lost, and shouldn't try - // to do anything fancy. + // an instruction, return nullptr. In this case, we're probably lost, + // and shouldn't try to do anything fancy. insn_offset = m_instruction_ranges[i] @@ -297,8 +294,7 @@ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP)); // Stepping through ranges using breakpoints doesn't work yet, but with this - // off we fall back to instruction - // single stepping. + // off we fall back to instruction single stepping. if (!m_use_fast_step) return false; @@ -383,9 +379,8 @@ size_t num_owners = bp_site_sp->GetNumberOfOwners(); bool explains_stop = true; // If all the owners are internal, then we are probably just stepping over - // this range from multiple threads, - // or multiple frames, so we want to continue. If one is not internal, then - // we should not explain the stop, + // this range from multiple threads, or multiple frames, so we want to + // continue. If one is not internal, then we should not explain the stop, // and let the user breakpoint handle the stop. for (size_t i = 0; i < num_owners; i++) { if (!bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint().IsInternal()) { @@ -418,8 +413,8 @@ // I do this check first because we might have stepped somewhere that will // fool InRange into // thinking it needs to step past the end of that line. This happens, for - // instance, when stepping - // over inlined code that is in the middle of the current line. + // instance, when stepping over inlined code that is in the middle of the + // current line. if (!m_no_more_plans) return false; @@ -457,8 +452,8 @@ } return true; } else if (frame_order == eFrameCompareEqual && InSymbol()) { - // If we are not in a place we should step through, we've gotten stale. - // One tricky bit here is that some stubs don't push a frame, so we should. + // If we are not in a place we should step through, we've gotten stale. One + // tricky bit here is that some stubs don't push a frame, so we should. // check that we are in the same symbol. if (!InRange()) { // Set plan Complete when we reach next instruction just after the range Index: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp +++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp @@ -26,9 +26,8 @@ //---------------------------------------------------------------------- // ThreadPlanStepThrough: If the current instruction is a trampoline, step -// through it -// If it is the beginning of the prologue of a function, step through that as -// well. +// through it If it is the beginning of the prologue of a function, step +// through that as well. // FIXME: At present only handles DYLD trampolines. //---------------------------------------------------------------------- @@ -49,9 +48,8 @@ m_start_address = GetThread().GetRegisterContext()->GetPC(0); // We are going to return back to the concrete frame 1, we might pass by - // some inlined code that we're in - // the middle of by doing this, but it's easier than trying to figure out - // where the inlined code might return to. + // some inlined code that we're in the middle of by doing this, but it's + // easier than trying to figure out where the inlined code might return to. StackFrameSP return_frame_sp = m_thread.GetFrameWithStackID(m_stack_id); @@ -136,10 +134,8 @@ bool ThreadPlanStepThrough::DoPlanExplainsStop(Event *event_ptr) { // If we have a sub-plan, it will have been asked first if we explain the - // stop, and - // we won't get asked. The only time we would be the one directly asked this - // question - // is if we hit our backstop breakpoint. + // stop, and we won't get asked. The only time we would be the one directly + // asked this question is if we hit our backstop breakpoint. return HitOurBackstopBreakpoint(); } @@ -156,8 +152,7 @@ } // If we don't have a sub-plan, then we're also done (can't see how we would - // ever get here - // without a plan, but just in case. + // ever get here without a plan, but just in case. if (!m_sub_plan_sp) { SetPlanComplete(); @@ -165,15 +160,13 @@ } // If the current sub plan is not done, we don't want to stop. Actually, we - // probably won't - // ever get here in this state, since we generally won't get asked any - // questions if out - // current sub-plan is not done... + // probably won't ever get here in this state, since we generally won't get + // asked any questions if out current sub-plan is not done... if (!m_sub_plan_sp->IsPlanComplete()) return false; - // If our current sub plan failed, then let's just run to our backstop. If we - // can't do that then just stop. + // If our current sub plan failed, then let's just run to our backstop. If + // we can't do that then just stop. if (!m_sub_plan_sp->PlanSucceeded()) { if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) { m_sub_plan_sp.reset(); @@ -185,8 +178,7 @@ } // Next see if there is a specific step through plan at our current pc (these - // might - // chain, for instance stepping through a dylib trampoline to the objc + // might chain, for instance stepping through a dylib trampoline to the objc // dispatch function...) LookForPlanToStepThroughFromCurrentPC(); if (m_sub_plan_sp) { Index: lldb/trunk/source/Target/ThreadPlanStepUntil.cpp =================================================================== --- lldb/trunk/source/Target/ThreadPlanStepUntil.cpp +++ lldb/trunk/source/Target/ThreadPlanStepUntil.cpp @@ -151,8 +151,8 @@ StopReason reason = stop_info_sp->GetStopReason(); if (reason == eStopReasonBreakpoint) { - // If this is OUR breakpoint, we're fine, otherwise we don't know why this - // happened... + // If this is OUR breakpoint, we're fine, otherwise we don't know why + // this happened... BreakpointSiteSP this_site = m_thread.GetProcess()->GetBreakpointSiteList().FindByID( stop_info_sp->GetValue()); @@ -163,18 +163,13 @@ if (this_site->IsBreakpointAtThisSite(m_return_bp_id)) { // If we are at our "step out" breakpoint, and the stack depth has - // shrunk, then - // this is indeed our stop. - // If the stack depth has grown, then we've hit our step out breakpoint - // recursively. - // If we are the only breakpoint at that location, then we do explain - // the stop, and - // we'll just continue. - // If there was another breakpoint here, then we don't explain the stop, - // but we won't - // mark ourselves Completed, because maybe that breakpoint will - // continue, and then - // we'll finish the "until". + // shrunk, then this is indeed our stop. If the stack depth has grown, + // then we've hit our step out breakpoint recursively. If we are the + // only breakpoint at that location, then we do explain the stop, and + // we'll just continue. If there was another breakpoint here, then we + // don't explain the stop, but we won't mark ourselves Completed, + // because maybe that breakpoint will continue, and then we'll finish + // the "until". bool done; StackID cur_frame_zero_id; @@ -209,8 +204,8 @@ else { StackFrameSP older_frame_sp = m_thread.GetStackFrameAtIndex(1); - // But if we can't even unwind one frame we should just get out of - // here & stop... + // But if we can't even unwind one frame we should just get out + // of here & stop... if (older_frame_sp) { const SymbolContext &older_context = older_frame_sp->GetSymbolContext(eSymbolContextEverything); @@ -230,8 +225,8 @@ // Otherwise we've hit this breakpoint recursively. If we're the // only breakpoint here, then we do explain the stop, and we'll - // continue. - // If not then we should let higher plans handle this stop. + // continue. If not then we should let higher plans handle this + // stop. if (this_site->GetNumberOfOwners() == 1) m_explains_stop = true; else { @@ -242,8 +237,8 @@ } } } - // If we get here we haven't hit any of our breakpoints, so let the higher - // plans take care of the stop. + // If we get here we haven't hit any of our breakpoints, so let the + // higher plans take care of the stop. m_explains_stop = false; return; } else if (IsUsuallyUnexplainedStopReason(reason)) { @@ -256,16 +251,15 @@ bool ThreadPlanStepUntil::DoPlanExplainsStop(Event *event_ptr) { // We don't explain signals or breakpoints (breakpoints that handle stepping - // in or - // out will be handled by a child plan. + // in or out will be handled by a child plan. AnalyzeStop(); return m_explains_stop; } bool ThreadPlanStepUntil::ShouldStop(Event *event_ptr) { - // If we've told our self in ExplainsStop that we plan to continue, then - // do so here. Otherwise, as long as this thread has stopped for a reason, - // we will stop. + // If we've told our self in ExplainsStop that we plan to continue, then do + // so here. Otherwise, as long as this thread has stopped for a reason, we + // will stop. StopInfoSP stop_info_sp = GetPrivateStopInfo(); if (!stop_info_sp || stop_info_sp->GetStopReason() == eStopReasonNone) Index: lldb/trunk/source/Target/UnixSignals.cpp =================================================================== --- lldb/trunk/source/Target/UnixSignals.cpp +++ lldb/trunk/source/Target/UnixSignals.cpp @@ -66,9 +66,8 @@ void UnixSignals::Reset() { // This builds one standard set of Unix Signals. If yours aren't quite in - // this - // order, you can either subclass this class, and use Add & Remove to change - // them + // this order, you can either subclass this class, and use Add & Remove to + // change them // or you can subclass and build them afresh in your constructor; // // Note: the signals below are the Darwin signals. Do not change these! @@ -306,8 +305,8 @@ bool signal_notify = false; GetSignalInfo(signo, signal_suppress, signal_stop, signal_notify); - // If any of filtering conditions are not met, - // we move on to the next signal. + // If any of filtering conditions are not met, we move on to the next + // signal. if (should_suppress.hasValue() && signal_suppress != should_suppress.getValue()) continue; Index: lldb/trunk/source/Utility/ArchSpec.cpp =================================================================== --- lldb/trunk/source/Utility/ArchSpec.cpp +++ lldb/trunk/source/Utility/ArchSpec.cpp @@ -223,8 +223,8 @@ "kalimba5"}}; // Ensure that we have an entry in the g_core_definitions for each core. If you -// comment out an entry above, -// you will need to comment out the corresponding ArchSpec::Core enumeration. +// comment out an entry above, you will need to comment out the corresponding +// ArchSpec::Core enumeration. static_assert(sizeof(g_core_definitions) / sizeof(CoreDefinition) == ArchSpec::kNumCores, "make sure we have one core definition for each core"); @@ -891,9 +891,9 @@ if (GetTriple().getArch() == llvm::Triple::UnknownArch) { GetTriple().setArch(other.GetTriple().getArch()); - // MachO unknown64 isn't really invalid as the debugger can - // still obtain information from the binary, e.g. line tables. - // As such, we don't update the core here. + // MachO unknown64 isn't really invalid as the debugger can still obtain + // information from the binary, e.g. line tables. As such, we don't update + // the core here. if (other.GetCore() != eCore_uknownMach64) UpdateCore(); } @@ -903,9 +903,8 @@ GetTriple().setEnvironment(other.GetTriple().getEnvironment()); } // If this and other are both arm ArchSpecs and this ArchSpec is a generic - // "some kind of arm" - // spec but the other ArchSpec is a specific arm core, adopt the specific arm - // core. + // "some kind of arm" spec but the other ArchSpec is a specific arm core, + // adopt the specific arm core. if (GetTriple().getArch() == llvm::Triple::arm && other.GetTriple().getArch() == llvm::Triple::arm && IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic && @@ -931,24 +930,21 @@ if (core_def) { m_core = core_def->core; update_triple = false; - // Always use the architecture name because it might be more descriptive - // than the architecture enum ("armv7" -> llvm::Triple::arm). + // Always use the architecture name because it might be more + // descriptive than the architecture enum ("armv7" -> + // llvm::Triple::arm). m_triple.setArchName(llvm::StringRef(core_def->name)); if (arch_type == eArchTypeMachO) { m_triple.setVendor(llvm::Triple::Apple); // Don't set the OS. It could be simulator, macosx, ios, watchos, - // tvos. We could - // get close with the cpu type - but we can't get it right all of the - // time. Better - // to leave this unset so other sections of code will set it when they - // have more - // information. + // tvos. We could get close with the cpu type - but we can't get it + // right all of the time. Better to leave this unset so other + // sections of code will set it when they have more information. // NB: don't call m_triple.setOS (llvm::Triple::UnknownOS). That sets // the OSName to // "unknown" and the ArchSpec::TripleVendorWasSpecified() method says - // that any - // OSName setting means it was specified. + // that any OSName setting means it was specified. } else if (arch_type == eArchTypeELF) { switch (os) { case llvm::ELF::ELFOSABI_AIX: @@ -977,7 +973,8 @@ m_triple.setVendor(llvm::Triple::UnknownVendor); m_triple.setOS(llvm::Triple::UnknownOS); } - // Fall back onto setting the machine type if the arch by name failed... + // Fall back onto setting the machine type if the arch by name + // failed... if (m_triple.getArch() == llvm::Triple::UnknownArch) m_triple.setArch(core_def->machine); } @@ -1020,10 +1017,9 @@ return true; // If one of the environment is Android and the other one is EABI then they - // are considered to - // be compatible. This is required as a workaround for shared libraries - // compiled for Android - // without the NOTE section indicating that they are using the Android ABI. + // are considered to be compatible. This is required as a workaround for + // shared libraries compiled for Android without the NOTE section indicating + // that they are using the Android ABI. if ((lhs == llvm::Triple::Android && rhs == llvm::Triple::EABI) || (rhs == llvm::Triple::Android && lhs == llvm::Triple::EABI) || (lhs == llvm::Triple::GNUEABI && rhs == llvm::Triple::EABI) || @@ -1055,8 +1051,8 @@ if (lhs_triple_vendor != rhs_triple_vendor) { const bool rhs_vendor_specified = rhs.TripleVendorWasSpecified(); const bool lhs_vendor_specified = TripleVendorWasSpecified(); - // Both architectures had the vendor specified, so if they aren't - // equal then we return false + // Both architectures had the vendor specified, so if they aren't equal + // then we return false if (rhs_vendor_specified && lhs_vendor_specified) return false; @@ -1071,8 +1067,8 @@ if (lhs_triple_os != rhs_triple_os) { const bool rhs_os_specified = rhs.TripleOSWasSpecified(); const bool lhs_os_specified = TripleOSWasSpecified(); - // Both architectures had the OS specified, so if they aren't - // equal then we return false + // Both architectures had the OS specified, so if they aren't equal then + // we return false if (rhs_os_specified && lhs_os_specified) return false; @@ -1099,9 +1095,9 @@ const CoreDefinition *core_def = FindCoreDefinition(arch_name); if (core_def) { m_core = core_def->core; - // Set the byte order to the default byte order for an architecture. - // This can be modified if needed for cases when cores handle both - // big and little endian + // Set the byte order to the default byte order for an architecture. This + // can be modified if needed for cases when cores handle both big and + // little endian m_byte_order = core_def->default_byte_order; } else { Clear(); @@ -1198,9 +1194,8 @@ break; // v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization - // Cortex-M0 - ARMv6-M - armv6m - // Cortex-M3 - ARMv7-M - armv7m - // Cortex-M4 - ARMv7E-M - armv7em + // Cortex-M0 - ARMv6-M - armv6m Cortex-M3 - ARMv7-M - armv7m Cortex-M4 - + // ARMv7E-M - armv7em case ArchSpec::eCore_arm_armv7em: if (!enforce_exact_match) { if (core2 == ArchSpec::eCore_arm_generic) @@ -1216,9 +1211,8 @@ break; // v. https://en.wikipedia.org/wiki/ARM_Cortex-M#Silicon_customization - // Cortex-M0 - ARMv6-M - armv6m - // Cortex-M3 - ARMv7-M - armv7m - // Cortex-M4 - ARMv7E-M - armv7em + // Cortex-M0 - ARMv6-M - armv6m Cortex-M3 - ARMv7-M - armv7m Cortex-M4 - + // ARMv7E-M - armv7em case ArchSpec::eCore_arm_armv7m: if (!enforce_exact_match) { if (core2 == ArchSpec::eCore_arm_generic) @@ -1466,9 +1460,8 @@ // Cortex-M0 through Cortex-M7 are ARM processor cores which can only // execute thumb instructions. We map the cores to arch names like this: // - // Cortex-M0, Cortex-M0+, Cortex-M1: armv6m - // Cortex-M3: armv7m - // Cortex-M4, Cortex-M7: armv7em + // Cortex-M0, Cortex-M0+, Cortex-M1: armv6m Cortex-M3: armv7m Cortex-M4, + // Cortex-M7: armv7em if (GetCore() == ArchSpec::Core::eCore_arm_armv7m || GetCore() == ArchSpec::Core::eCore_arm_armv7em || Index: lldb/trunk/source/Utility/Args.cpp =================================================================== --- lldb/trunk/source/Utility/Args.cpp +++ lldb/trunk/source/Utility/Args.cpp @@ -19,12 +19,9 @@ // A helper function for argument parsing. // Parses the initial part of the first argument using normal double quote -// rules: -// backslash escapes the double quote and itself. The parsed string is appended -// to the second -// argument. The function returns the unparsed portion of the string, starting -// at the closing -// quote. +// rules: backslash escapes the double quote and itself. The parsed string is +// appended to the second argument. The function returns the unparsed portion +// of the string, starting at the closing quote. static llvm::StringRef ParseDoubleQuotes(llvm::StringRef quoted, std::string &result) { // Inside double quotes, '\' and '"' are special. @@ -49,8 +46,7 @@ } // If the character after the backslash is not a whitelisted escapable - // character, we - // leave the character sequence untouched. + // character, we leave the character sequence untouched. if (strchr(k_escapable_characters, quoted.front()) == nullptr) result += '\\'; @@ -84,10 +80,10 @@ // strings. std::string arg; - // Since we can have multiple quotes that form a single command - // in a command like: "Hello "world'!' (which will make a single - // argument "Hello world!") we remember the first quote character - // we encounter and use that for the quote character. + // Since we can have multiple quotes that form a single command in a command + // like: "Hello "world'!' (which will make a single argument "Hello world!") + // we remember the first quote character we encounter and use that for the + // quote character. char first_quote_char = '\0'; bool arg_complete = false; @@ -110,8 +106,7 @@ } // If the character after the backslash is not a whitelisted escapable - // character, we - // leave the character sequence untouched. + // character, we leave the character sequence untouched. if (strchr(" \t\\'\"`", command.front()) == nullptr) arg += '\\'; @@ -122,8 +117,8 @@ case ' ': case '\t': - // We are not inside any quotes, we just found a space after an - // argument. We are done. + // We are not inside any quotes, we just found a space after an argument. + // We are done. arg_complete = true; break; @@ -138,8 +133,7 @@ command = ParseDoubleQuotes(command, arg); else { // For single quotes, we simply skip ahead to the matching quote - // character - // (or the end of the string). + // character (or the end of the string). size_t quoted = command.find(special); arg += command.substr(0, quoted); command = command.substr(quoted); @@ -274,9 +268,9 @@ assert(!m_argv.empty()); // TODO: functions like execve and posix_spawnp exhibit undefined behavior // when argv or envp is null. So the code below is actually wrong. However, - // other code in LLDB depends on it being null. The code has been acting this - // way for some time, so it makes sense to leave it this way until someone - // has the time to come along and fix it. + // other code in LLDB depends on it being null. The code has been acting + // this way for some time, so it makes sense to leave it this way until + // someone has the time to come along and fix it. return (m_argv.size() > 1) ? m_argv.data() : nullptr; } @@ -555,17 +549,17 @@ case '0': // 1 to 3 octal chars { - // Make a string that can hold onto the initial zero char, - // up to 3 octal digits, and a terminating NULL. + // Make a string that can hold onto the initial zero char, up to 3 + // octal digits, and a terminating NULL. char oct_str[5] = {'\0', '\0', '\0', '\0', '\0'}; int i; for (i = 0; (p[i] >= '0' && p[i] <= '7') && i < 4; ++i) oct_str[i] = p[i]; - // We don't want to consume the last octal character since - // the main for loop will do this for us, so we advance p by - // one less than i (even if i is zero) + // We don't want to consume the last octal character since the main + // for loop will do this for us, so we advance p by one less than i + // (even if i is zero) p += i - 1; unsigned long octal_value = ::strtoul(oct_str, nullptr, 8); if (octal_value <= UINT8_MAX) { @@ -596,8 +590,8 @@ break; default: - // Just desensitize any other character by just printing what - // came after the '\' + // Just desensitize any other character by just printing what came + // after the '\' dst.append(1, *p); break; } Index: lldb/trunk/source/Utility/ConstString.cpp =================================================================== --- lldb/trunk/source/Utility/ConstString.cpp +++ lldb/trunk/source/Utility/ConstString.cpp @@ -43,8 +43,8 @@ static size_t GetConstCStringLength(const char *ccstr) { if (ccstr != nullptr) { - // Since the entry is read only, and we derive the entry entirely from the - // pointer, we don't need the lock. + // Since the entry is read only, and we derive the entry entirely from + // the pointer, we don't need the lock. const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr); return entry.getKey().size(); } @@ -155,9 +155,8 @@ } //------------------------------------------------------------------ - // Return the size in bytes that this object and any items in its - // collection of uniqued strings + data count values takes in - // memory. + // Return the size in bytes that this object and any items in its collection + // of uniqued strings + data count values takes in memory. //------------------------------------------------------------------ size_t MemorySize() const { size_t mem_size = sizeof(Pool); @@ -184,15 +183,14 @@ }; //---------------------------------------------------------------------- -// Frameworks and dylibs aren't supposed to have global C++ -// initializers so we hide the string pool in a static function so -// that it will get initialized on the first call to this static -// function. +// Frameworks and dylibs aren't supposed to have global C++ initializers so we +// hide the string pool in a static function so that it will get initialized on +// the first call to this static function. // -// Note, for now we make the string pool a pointer to the pool, because -// we can't guarantee that some objects won't get destroyed after the -// global destructor chain is run, and trying to make sure no destructors -// touch ConstStrings is difficult. So we leak the pool instead. +// Note, for now we make the string pool a pointer to the pool, because we +// can't guarantee that some objects won't get destroyed after the global +// destructor chain is run, and trying to make sure no destructors touch +// ConstStrings is difficult. So we leak the pool instead. //---------------------------------------------------------------------- static Pool &StringPool() { static llvm::once_flag g_pool_initialization_flag; @@ -246,8 +244,8 @@ return true; // Since the pointers weren't equal, and identical ConstStrings always have - // identical pointers, - // the result must be false for case sensitive equality test. + // identical pointers, the result must be false for case sensitive equality + // test. if (case_sensitive) return false; Index: lldb/trunk/source/Utility/DataBufferHeap.cpp =================================================================== --- lldb/trunk/source/Utility/DataBufferHeap.cpp +++ lldb/trunk/source/Utility/DataBufferHeap.cpp @@ -22,8 +22,7 @@ DataBufferHeap::DataBufferHeap() : m_data() {} //---------------------------------------------------------------------- -// Initialize this class with "n" characters and fill the buffer -// with "ch". +// Initialize this class with "n" characters and fill the buffer with "ch". //---------------------------------------------------------------------- DataBufferHeap::DataBufferHeap(lldb::offset_t n, uint8_t ch) : m_data() { if (n < m_data.max_size()) @@ -31,8 +30,7 @@ } //---------------------------------------------------------------------- -// Initialize this class with a copy of the "n" bytes from the "bytes" -// buffer. +// Initialize this class with a copy of the "n" bytes from the "bytes" buffer. //---------------------------------------------------------------------- DataBufferHeap::DataBufferHeap(const void *src, lldb::offset_t src_len) : m_data() { @@ -40,22 +38,21 @@ } //---------------------------------------------------------------------- -// Virtual destructor since this class inherits from a pure virtual -// base class. +// Virtual destructor since this class inherits from a pure virtual base class. //---------------------------------------------------------------------- DataBufferHeap::~DataBufferHeap() = default; //---------------------------------------------------------------------- -// Return a pointer to the bytes owned by this object, or nullptr if -// the object contains no bytes. +// Return a pointer to the bytes owned by this object, or nullptr if the object +// contains no bytes. //---------------------------------------------------------------------- uint8_t *DataBufferHeap::GetBytes() { return (m_data.empty() ? nullptr : m_data.data()); } //---------------------------------------------------------------------- -// Return a const pointer to the bytes owned by this object, or nullptr -// if the object contains no bytes. +// Return a const pointer to the bytes owned by this object, or nullptr if the +// object contains no bytes. //---------------------------------------------------------------------- const uint8_t *DataBufferHeap::GetBytes() const { return (m_data.empty() ? nullptr : m_data.data()); @@ -67,8 +64,8 @@ uint64_t DataBufferHeap::GetByteSize() const { return m_data.size(); } //---------------------------------------------------------------------- -// Sets the number of bytes that this object should be able to -// contain. This can be used prior to copying data into the buffer. +// Sets the number of bytes that this object should be able to contain. This +// can be used prior to copying data into the buffer. //---------------------------------------------------------------------- uint64_t DataBufferHeap::SetByteSize(uint64_t new_size) { m_data.resize(new_size); Index: lldb/trunk/source/Utility/DataEncoder.cpp =================================================================== --- lldb/trunk/source/Utility/DataEncoder.cpp +++ lldb/trunk/source/Utility/DataEncoder.cpp @@ -34,8 +34,8 @@ m_data_sp() {} //---------------------------------------------------------------------- -// This constructor allows us to use data that is owned by someone else. -// The data must stay around as long as this object is valid. +// This constructor allows us to use data that is owned by someone else. The +// data must stay around as long as this object is valid. //---------------------------------------------------------------------- DataEncoder::DataEncoder(void *data, uint32_t length, ByteOrder endian, uint8_t addr_size) @@ -43,11 +43,10 @@ m_byte_order(endian), m_addr_size(addr_size), m_data_sp() {} //---------------------------------------------------------------------- -// Make a shared pointer reference to the shared data in "data_sp" and -// set the endian swapping setting to "swap", and the address size to -// "addr_size". The shared data reference will ensure the data lives -// as long as any DataEncoder objects exist that have a reference to -// this data. +// Make a shared pointer reference to the shared data in "data_sp" and set the +// endian swapping setting to "swap", and the address size to "addr_size". The +// shared data reference will ensure the data lives as long as any DataEncoder +// objects exist that have a reference to this data. //---------------------------------------------------------------------- DataEncoder::DataEncoder(const DataBufferSP &data_sp, ByteOrder endian, uint8_t addr_size) @@ -59,9 +58,8 @@ DataEncoder::~DataEncoder() = default; //------------------------------------------------------------------ -// Clears the object contents back to a default invalid state, and -// release any references to shared data that this object may -// contain. +// Clears the object contents back to a default invalid state, and release any +// references to shared data that this object may contain. //------------------------------------------------------------------ void DataEncoder::Clear() { m_start = nullptr; @@ -72,8 +70,8 @@ } //------------------------------------------------------------------ -// If this object contains shared data, this function returns the -// offset into that shared data. Else zero is returned. +// If this object contains shared data, this function returns the offset into +// that shared data. Else zero is returned. //------------------------------------------------------------------ size_t DataEncoder::GetSharedDataOffset() const { if (m_start != nullptr) { @@ -90,13 +88,12 @@ } //---------------------------------------------------------------------- -// Set the data with which this object will extract from to data -// starting at BYTES and set the length of the data to LENGTH bytes -// long. The data is externally owned must be around at least as -// long as this object points to the data. No copy of the data is -// made, this object just refers to this data and can extract from -// it. If this object refers to any shared data upon entry, the -// reference to that data will be released. Is SWAP is set to true, +// Set the data with which this object will extract from to data starting at +// BYTES and set the length of the data to LENGTH bytes long. The data is +// externally owned must be around at least as long as this object points to +// the data. No copy of the data is made, this object just refers to this data +// and can extract from it. If this object refers to any shared data upon +// entry, the reference to that data will be released. Is SWAP is set to true, // any data extracted will be endian swapped. //---------------------------------------------------------------------- uint32_t DataEncoder::SetData(void *bytes, uint32_t length, ByteOrder endian) { @@ -113,18 +110,17 @@ } //---------------------------------------------------------------------- -// Assign the data for this object to be a subrange of the shared -// data in "data_sp" starting "data_offset" bytes into "data_sp" -// and ending "data_length" bytes later. If "data_offset" is not -// a valid offset into "data_sp", then this object will contain no -// bytes. If "data_offset" is within "data_sp" yet "data_length" is -// too large, the length will be capped at the number of bytes -// remaining in "data_sp". A ref counted pointer to the data in -// "data_sp" will be made in this object IF the number of bytes this -// object refers to in greater than zero (if at least one byte was -// available starting at "data_offset") to ensure the data stays -// around as long as it is needed. The address size and endian swap -// settings will remain unchanged from their current settings. +// Assign the data for this object to be a subrange of the shared data in +// "data_sp" starting "data_offset" bytes into "data_sp" and ending +// "data_length" bytes later. If "data_offset" is not a valid offset into +// "data_sp", then this object will contain no bytes. If "data_offset" is +// within "data_sp" yet "data_length" is too large, the length will be capped +// at the number of bytes remaining in "data_sp". A ref counted pointer to the +// data in "data_sp" will be made in this object IF the number of bytes this +// object refers to in greater than zero (if at least one byte was available +// starting at "data_offset") to ensure the data stays around as long as it is +// needed. The address size and endian swap settings will remain unchanged from +// their current settings. //---------------------------------------------------------------------- uint32_t DataEncoder::SetData(const DataBufferSP &data_sp, uint32_t data_offset, uint32_t data_length) { @@ -149,8 +145,8 @@ uint32_t new_size = GetByteSize(); - // Don't hold a shared pointer to the data buffer if we don't share - // any valid bytes in the shared buffer. + // Don't hold a shared pointer to the data buffer if we don't share any valid + // bytes in the shared buffer. if (new_size == 0) m_data_sp.reset(); @@ -158,8 +154,8 @@ } //---------------------------------------------------------------------- -// Extract a single unsigned char from the binary data and update -// the offset pointed to by "offset_ptr". +// Extract a single unsigned char from the binary data and update the offset +// pointed to by "offset_ptr". // // RETURNS the byte that was extracted, or zero on failure. //---------------------------------------------------------------------- @@ -208,12 +204,12 @@ } //---------------------------------------------------------------------- -// Extract a single integer value from the data and update the offset -// pointed to by "offset_ptr". The size of the extracted integer -// is specified by the "byte_size" argument. "byte_size" should have -// a value >= 1 and <= 8 since the return value is only 64 bits -// wide. Any "byte_size" values less than 1 or greater than 8 will -// result in nothing being extracted, and zero being returned. +// Extract a single integer value from the data and update the offset pointed +// to by "offset_ptr". The size of the extracted integer is specified by the +// "byte_size" argument. "byte_size" should have a value >= 1 and <= 8 since +// the return value is only 64 bits wide. Any "byte_size" values less than 1 or +// greater than 8 will result in nothing being extracted, and zero being +// returned. // // RETURNS the integer value that was extracted, or zero on failure. //---------------------------------------------------------------------- Index: lldb/trunk/source/Utility/DataExtractor.cpp =================================================================== --- lldb/trunk/source/Utility/DataExtractor.cpp +++ lldb/trunk/source/Utility/DataExtractor.cpp @@ -126,8 +126,8 @@ m_data_sp(), m_target_byte_size(1) {} //---------------------------------------------------------------------- -// This constructor allows us to use data that is owned by someone else. -// The data must stay around as long as this object is valid. +// This constructor allows us to use data that is owned by someone else. The +// data must stay around as long as this object is valid. //---------------------------------------------------------------------- DataExtractor::DataExtractor(const void *data, offset_t length, ByteOrder endian, uint32_t addr_size, @@ -143,11 +143,10 @@ } //---------------------------------------------------------------------- -// Make a shared pointer reference to the shared data in "data_sp" and -// set the endian swapping setting to "swap", and the address size to -// "addr_size". The shared data reference will ensure the data lives -// as long as any DataExtractor objects exist that have a reference to -// this data. +// Make a shared pointer reference to the shared data in "data_sp" and set the +// endian swapping setting to "swap", and the address size to "addr_size". The +// shared data reference will ensure the data lives as long as any +// DataExtractor objects exist that have a reference to this data. //---------------------------------------------------------------------- DataExtractor::DataExtractor(const DataBufferSP &data_sp, ByteOrder endian, uint32_t addr_size, @@ -162,11 +161,11 @@ } //---------------------------------------------------------------------- -// Initialize this object with a subset of the data bytes in "data". -// If "data" contains shared data, then a reference to this shared -// data will added and the shared data will stay around as long -// as any object contains a reference to that data. The endian -// swap and address size settings are copied from "data". +// Initialize this object with a subset of the data bytes in "data". If "data" +// contains shared data, then a reference to this shared data will added and +// the shared data will stay around as long as any object contains a reference +// to that data. The endian swap and address size settings are copied from +// "data". //---------------------------------------------------------------------- DataExtractor::DataExtractor(const DataExtractor &data, offset_t offset, offset_t length, uint32_t target_byte_size /*=1*/) @@ -210,9 +209,8 @@ DataExtractor::~DataExtractor() = default; //------------------------------------------------------------------ -// Clears the object contents back to a default invalid state, and -// release any references to shared data that this object may -// contain. +// Clears the object contents back to a default invalid state, and release any +// references to shared data that this object may contain. //------------------------------------------------------------------ void DataExtractor::Clear() { m_start = nullptr; @@ -223,8 +221,8 @@ } //------------------------------------------------------------------ -// If this object contains shared data, this function returns the -// offset into that shared data. Else zero is returned. +// If this object contains shared data, this function returns the offset into +// that shared data. Else zero is returned. //------------------------------------------------------------------ size_t DataExtractor::GetSharedDataOffset() const { if (m_start != nullptr) { @@ -241,13 +239,12 @@ } //---------------------------------------------------------------------- -// Set the data with which this object will extract from to data -// starting at BYTES and set the length of the data to LENGTH bytes -// long. The data is externally owned must be around at least as -// long as this object points to the data. No copy of the data is -// made, this object just refers to this data and can extract from -// it. If this object refers to any shared data upon entry, the -// reference to that data will be released. Is SWAP is set to true, +// Set the data with which this object will extract from to data starting at +// BYTES and set the length of the data to LENGTH bytes long. The data is +// externally owned must be around at least as long as this object points to +// the data. No copy of the data is made, this object just refers to this data +// and can extract from it. If this object refers to any shared data upon +// entry, the reference to that data will be released. Is SWAP is set to true, // any data extracted will be endian swapped. //---------------------------------------------------------------------- lldb::offset_t DataExtractor::SetData(const void *bytes, offset_t length, @@ -265,18 +262,16 @@ } //---------------------------------------------------------------------- -// Assign the data for this object to be a subrange in "data" -// starting "data_offset" bytes into "data" and ending "data_length" -// bytes later. If "data_offset" is not a valid offset into "data", -// then this object will contain no bytes. If "data_offset" is -// within "data" yet "data_length" is too large, the length will be -// capped at the number of bytes remaining in "data". If "data" -// contains a shared pointer to other data, then a ref counted -// pointer to that data will be made in this object. If "data" -// doesn't contain a shared pointer to data, then the bytes referred -// to in "data" will need to exist at least as long as this object -// refers to those bytes. The address size and endian swap settings -// are copied from the current values in "data". +// Assign the data for this object to be a subrange in "data" starting +// "data_offset" bytes into "data" and ending "data_length" bytes later. If +// "data_offset" is not a valid offset into "data", then this object will +// contain no bytes. If "data_offset" is within "data" yet "data_length" is too +// large, the length will be capped at the number of bytes remaining in "data". +// If "data" contains a shared pointer to other data, then a ref counted +// pointer to that data will be made in this object. If "data" doesn't contain +// a shared pointer to data, then the bytes referred to in "data" will need to +// exist at least as long as this object refers to those bytes. The address +// size and endian swap settings are copied from the current values in "data". //---------------------------------------------------------------------- lldb::offset_t DataExtractor::SetData(const DataExtractor &data, offset_t data_offset, @@ -303,18 +298,17 @@ } //---------------------------------------------------------------------- -// Assign the data for this object to be a subrange of the shared -// data in "data_sp" starting "data_offset" bytes into "data_sp" -// and ending "data_length" bytes later. If "data_offset" is not -// a valid offset into "data_sp", then this object will contain no -// bytes. If "data_offset" is within "data_sp" yet "data_length" is -// too large, the length will be capped at the number of bytes -// remaining in "data_sp". A ref counted pointer to the data in -// "data_sp" will be made in this object IF the number of bytes this -// object refers to in greater than zero (if at least one byte was -// available starting at "data_offset") to ensure the data stays -// around as long as it is needed. The address size and endian swap -// settings will remain unchanged from their current settings. +// Assign the data for this object to be a subrange of the shared data in +// "data_sp" starting "data_offset" bytes into "data_sp" and ending +// "data_length" bytes later. If "data_offset" is not a valid offset into +// "data_sp", then this object will contain no bytes. If "data_offset" is +// within "data_sp" yet "data_length" is too large, the length will be capped +// at the number of bytes remaining in "data_sp". A ref counted pointer to the +// data in "data_sp" will be made in this object IF the number of bytes this +// object refers to in greater than zero (if at least one byte was available +// starting at "data_offset") to ensure the data stays around as long as it is +// needed. The address size and endian swap settings will remain unchanged from +// their current settings. //---------------------------------------------------------------------- lldb::offset_t DataExtractor::SetData(const DataBufferSP &data_sp, offset_t data_offset, @@ -340,8 +334,8 @@ size_t new_size = GetByteSize(); - // Don't hold a shared pointer to the data buffer if we don't share - // any valid bytes in the shared buffer. + // Don't hold a shared pointer to the data buffer if we don't share any valid + // bytes in the shared buffer. if (new_size == 0) m_data_sp.reset(); @@ -349,8 +343,8 @@ } //---------------------------------------------------------------------- -// Extract a single unsigned char from the binary data and update -// the offset pointed to by "offset_ptr". +// Extract a single unsigned char from the binary data and update the offset +// pointed to by "offset_ptr". // // RETURNS the byte that was extracted, or zero on failure. //---------------------------------------------------------------------- @@ -362,13 +356,12 @@ } //---------------------------------------------------------------------- -// Extract "count" unsigned chars from the binary data and update the -// offset pointed to by "offset_ptr". The extracted data is copied into -// "dst". +// Extract "count" unsigned chars from the binary data and update the offset +// pointed to by "offset_ptr". The extracted data is copied into "dst". // // RETURNS the non-nullptr buffer pointer upon successful extraction of -// all the requested bytes, or nullptr when the data is not available in -// the buffer due to being out of bounds, or insufficient data. +// all the requested bytes, or nullptr when the data is not available in the +// buffer due to being out of bounds, or insufficient data. //---------------------------------------------------------------------- void *DataExtractor::GetU8(offset_t *offset_ptr, void *dst, uint32_t count) const { @@ -384,8 +377,8 @@ } //---------------------------------------------------------------------- -// Extract a single uint16_t from the data and update the offset -// pointed to by "offset_ptr". +// Extract a single uint16_t from the data and update the offset pointed to by +// "offset_ptr". // // RETURNS the uint16_t that was extracted, or zero on failure. //---------------------------------------------------------------------- @@ -432,13 +425,12 @@ } //---------------------------------------------------------------------- -// Extract "count" uint16_t values from the binary data and update -// the offset pointed to by "offset_ptr". The extracted data is -// copied into "dst". +// Extract "count" uint16_t values from the binary data and update the offset +// pointed to by "offset_ptr". The extracted data is copied into "dst". // // RETURNS the non-nullptr buffer pointer upon successful extraction of -// all the requested bytes, or nullptr when the data is not available -// in the buffer due to being out of bounds, or insufficient data. +// all the requested bytes, or nullptr when the data is not available in the +// buffer due to being out of bounds, or insufficient data. //---------------------------------------------------------------------- void *DataExtractor::GetU16(offset_t *offset_ptr, void *void_dst, uint32_t count) const { @@ -465,8 +457,8 @@ } //---------------------------------------------------------------------- -// Extract a single uint32_t from the data and update the offset -// pointed to by "offset_ptr". +// Extract a single uint32_t from the data and update the offset pointed to by +// "offset_ptr". // // RETURNS the uint32_t that was extracted, or zero on failure. //---------------------------------------------------------------------- @@ -484,13 +476,12 @@ } //---------------------------------------------------------------------- -// Extract "count" uint32_t values from the binary data and update -// the offset pointed to by "offset_ptr". The extracted data is -// copied into "dst". +// Extract "count" uint32_t values from the binary data and update the offset +// pointed to by "offset_ptr". The extracted data is copied into "dst". // // RETURNS the non-nullptr buffer pointer upon successful extraction of -// all the requested bytes, or nullptr when the data is not available -// in the buffer due to being out of bounds, or insufficient data. +// all the requested bytes, or nullptr when the data is not available in the +// buffer due to being out of bounds, or insufficient data. //---------------------------------------------------------------------- void *DataExtractor::GetU32(offset_t *offset_ptr, void *void_dst, uint32_t count) const { @@ -517,8 +508,8 @@ } //---------------------------------------------------------------------- -// Extract a single uint64_t from the data and update the offset -// pointed to by "offset_ptr". +// Extract a single uint64_t from the data and update the offset pointed to by +// "offset_ptr". // // RETURNS the uint64_t that was extracted, or zero on failure. //---------------------------------------------------------------------- @@ -538,9 +529,9 @@ //---------------------------------------------------------------------- // GetU64 // -// Get multiple consecutive 64 bit values. Return true if the entire -// read succeeds and increment the offset pointed to by offset_ptr, else -// return false and leave the offset pointed to by offset_ptr unchanged. +// Get multiple consecutive 64 bit values. Return true if the entire read +// succeeds and increment the offset pointed to by offset_ptr, else return +// false and leave the offset pointed to by offset_ptr unchanged. //---------------------------------------------------------------------- void *DataExtractor::GetU64(offset_t *offset_ptr, void *void_dst, uint32_t count) const { @@ -708,10 +699,10 @@ } //------------------------------------------------------------------ -// Extract a single address from the data and update the offset -// pointed to by "offset_ptr". The size of the extracted address -// comes from the "this->m_addr_size" member variable and should be -// set correctly prior to extracting any address values. +// Extract a single address from the data and update the offset pointed to by +// "offset_ptr". The size of the extracted address comes from the +// "this->m_addr_size" member variable and should be set correctly prior to +// extracting any address values. // // RETURNS the address that was extracted, or zero on failure. //------------------------------------------------------------------ @@ -730,10 +721,10 @@ } //------------------------------------------------------------------ -// Extract a single pointer from the data and update the offset -// pointed to by "offset_ptr". The size of the extracted pointer -// comes from the "this->m_addr_size" member variable and should be -// set correctly prior to extracting any pointer values. +// Extract a single pointer from the data and update the offset pointed to by +// "offset_ptr". The size of the extracted pointer comes from the +// "this->m_addr_size" member variable and should be set correctly prior to +// extracting any pointer values. // // RETURNS the pointer that was extracted, or zero on failure. //------------------------------------------------------------------ @@ -804,9 +795,9 @@ const uint8_t *src = (const uint8_t *)PeekData(src_offset, src_len); if (src) { if (dst_len >= src_len) { - // We are copying the entire value from src into dst. - // Calculate how many, if any, zeroes we need for the most - // significant bytes if "dst_len" is greater than "src_len"... + // We are copying the entire value from src into dst. Calculate how many, + // if any, zeroes we need for the most significant bytes if "dst_len" is + // greater than "src_len"... const size_t num_zeroes = dst_len - src_len; if (dst_byte_order == eByteOrderBig) { // Big endian, so we lead with zeroes... @@ -863,15 +854,13 @@ } //---------------------------------------------------------------------- -// Extracts a variable length NULL terminated C string from -// the data at the offset pointed to by "offset_ptr". The -// "offset_ptr" will be updated with the offset of the byte that -// follows the NULL terminator byte. +// Extracts a variable length NULL terminated C string from the data at the +// offset pointed to by "offset_ptr". The "offset_ptr" will be updated with +// the offset of the byte that follows the NULL terminator byte. // -// If the offset pointed to by "offset_ptr" is out of bounds, or if -// "length" is non-zero and there aren't enough available -// bytes, nullptr will be returned and "offset_ptr" will not be -// updated. +// If the offset pointed to by "offset_ptr" is out of bounds, or if "length" is +// non-zero and there aren't enough available bytes, nullptr will be returned +// and "offset_ptr" will not be updated. //---------------------------------------------------------------------- const char *DataExtractor::GetCStr(offset_t *offset_ptr) const { const char *cstr = (const char *)PeekData(*offset_ptr, 1); @@ -890,23 +879,21 @@ } // We reached the end of the data without finding a NULL C string - // terminator. Fall through and return nullptr otherwise anyone that - // would have used the result as a C string can wander into - // unknown memory... + // terminator. Fall through and return nullptr otherwise anyone that would + // have used the result as a C string can wander into unknown memory... } return nullptr; } //---------------------------------------------------------------------- -// Extracts a NULL terminated C string from the fixed length field of -// length "len" at the offset pointed to by "offset_ptr". -// The "offset_ptr" will be updated with the offset of the byte that -// follows the fixed length field. +// Extracts a NULL terminated C string from the fixed length field of length +// "len" at the offset pointed to by "offset_ptr". The "offset_ptr" will be +// updated with the offset of the byte that follows the fixed length field. // -// If the offset pointed to by "offset_ptr" is out of bounds, or if -// the offset plus the length of the field is out of bounds, or if the -// field does not contain a NULL terminator byte, nullptr will be returned -// and "offset_ptr" will not be updated. +// If the offset pointed to by "offset_ptr" is out of bounds, or if the offset +// plus the length of the field is out of bounds, or if the field does not +// contain a NULL terminator byte, nullptr will be returned and "offset_ptr" +// will not be updated. //---------------------------------------------------------------------- const char *DataExtractor::GetCStr(offset_t *offset_ptr, offset_t len) const { const char *cstr = (const char *)PeekData(*offset_ptr, len); @@ -921,22 +908,22 @@ } //------------------------------------------------------------------ -// Peeks at a string in the contained data. No verification is done -// to make sure the entire string lies within the bounds of this -// object's data, only "offset" is verified to be a valid offset. +// Peeks at a string in the contained data. No verification is done to make +// sure the entire string lies within the bounds of this object's data, only +// "offset" is verified to be a valid offset. // -// Returns a valid C string pointer if "offset" is a valid offset in -// this object's data, else nullptr is returned. +// Returns a valid C string pointer if "offset" is a valid offset in this +// object's data, else nullptr is returned. //------------------------------------------------------------------ const char *DataExtractor::PeekCStr(offset_t offset) const { return (const char *)PeekData(offset, 1); } //---------------------------------------------------------------------- -// Extracts an unsigned LEB128 number from this object's data -// starting at the offset pointed to by "offset_ptr". The offset -// pointed to by "offset_ptr" will be updated with the offset of the -// byte following the last extracted byte. +// Extracts an unsigned LEB128 number from this object's data starting at the +// offset pointed to by "offset_ptr". The offset pointed to by "offset_ptr" +// will be updated with the offset of the byte following the last extracted +// byte. // // Returned the extracted integer value. //---------------------------------------------------------------------- @@ -968,10 +955,10 @@ } //---------------------------------------------------------------------- -// Extracts an signed LEB128 number from this object's data -// starting at the offset pointed to by "offset_ptr". The offset -// pointed to by "offset_ptr" will be updated with the offset of the -// byte following the last extracted byte. +// Extracts an signed LEB128 number from this object's data starting at the +// offset pointed to by "offset_ptr". The offset pointed to by "offset_ptr" +// will be updated with the offset of the byte following the last extracted +// byte. // // Returned the extracted integer value. //---------------------------------------------------------------------- @@ -1010,10 +997,10 @@ } //---------------------------------------------------------------------- -// Skips a ULEB128 number (signed or unsigned) from this object's -// data starting at the offset pointed to by "offset_ptr". The -// offset pointed to by "offset_ptr" will be updated with the offset -// of the byte following the last extracted byte. +// Skips a ULEB128 number (signed or unsigned) from this object's data starting +// at the offset pointed to by "offset_ptr". The offset pointed to by +// "offset_ptr" will be updated with the offset of the byte following the last +// extracted byte. // // Returns the number of bytes consumed during the extraction. //---------------------------------------------------------------------- @@ -1036,15 +1023,14 @@ //---------------------------------------------------------------------- // Dumps bytes from this object's data to the stream "s" starting -// "start_offset" bytes into this data, and ending with the byte -// before "end_offset". "base_addr" will be added to the offset -// into the dumped data when showing the offset into the data in the -// output information. "num_per_line" objects of type "type" will -// be dumped with the option to override the format for each object -// with "type_format". "type_format" is a printf style formatting -// string. If "type_format" is nullptr, then an appropriate format -// string will be used for the supplied "type". If the stream "s" -// is nullptr, then the output will be send to Log(). +// "start_offset" bytes into this data, and ending with the byte before +// "end_offset". "base_addr" will be added to the offset into the dumped data +// when showing the offset into the data in the output information. +// "num_per_line" objects of type "type" will be dumped with the option to +// override the format for each object with "type_format". "type_format" is a +// printf style formatting string. If "type_format" is nullptr, then an +// appropriate format string will be used for the supplied "type". If the +// stream "s" is nullptr, then the output will be send to Log(). //---------------------------------------------------------------------- lldb::offset_t DataExtractor::PutToLog(Log *log, offset_t start_offset, offset_t length, uint64_t base_addr, Index: lldb/trunk/source/Utility/FastDemangle.cpp =================================================================== --- lldb/trunk/source/Utility/FastDemangle.cpp +++ lldb/trunk/source/Utility/FastDemangle.cpp @@ -200,8 +200,7 @@ if (growth > 1 << 20) growth = 1 << 20; - // ... but never grow by less than requested, - // or 1K, whichever is greater + // ... but never grow by less than requested, or 1K, whichever is greater if (min_growth < 1024) min_growth = 1024; if (growth < min_growth) @@ -282,9 +281,8 @@ if (index == m_rewrite_ranges_size) break; - // Affected ranges are either shuffled forward when after the - // insertion but before the source, or backward when inside the - // source + // Affected ranges are either shuffled forward when after the insertion + // but before the source, or backward when inside the source int candidate_offset = m_rewrite_ranges[index].offset; if (candidate_offset >= insertion_point_cookie) { if (candidate_offset < source_range.offset) { @@ -402,8 +400,7 @@ //---------------------------------------------------- // Rewrite methods // - // Write another copy of content already present - // earlier in the output buffer + // Write another copy of content already present earlier in the output buffer //---------------------------------------------------- void RewriteRange(BufferRange range) { @@ -436,11 +433,11 @@ //---------------------------------------------------- // TryParse methods // - // Provide information with return values instead of - // writing to the output buffer + // Provide information with return values instead of writing to the output + // buffer // - // Values indicating failure guarantee that the pre- - // call m_read_ptr is unchanged + // Values indicating failure guarantee that the pre- call m_read_ptr is + // unchanged //---------------------------------------------------- int TryParseNumber() { @@ -820,8 +817,8 @@ } // ::= [r] [V] [K] - // ::= R # & ref-qualifier - // ::= O # && ref-qualifier + // ::= R # & ref-qualifier + // ::= O # && ref-qualifier int TryParseQualifiers(bool allow_cv, bool allow_ro) { int qualifiers = QualifierNone; @@ -890,11 +887,10 @@ //---------------------------------------------------- // Parse methods // - // Consume input starting from m_read_ptr and produce - // buffered output at m_write_ptr + // Consume input starting from m_read_ptr and produce buffered output at + // m_write_ptr // - // Failures return false and may leave m_read_ptr in an - // indeterminate state + // Failures return false and may leave m_read_ptr in an indeterminate state //---------------------------------------------------- bool Parse(char character) { @@ -932,17 +928,14 @@ // ::= S _ // ::= S_ - // ::= Sa # ::std::allocator - // ::= Sb # ::std::basic_string - // ::= Ss # ::std::basic_string < char, + // ::= Sa # ::std::allocator ::= Sb # + // ::std::basic_string ::= Ss # ::std::basic_string < char, // ::std::char_traits, // ::std::allocator > // ::= Si # ::std::basic_istream - // > - // ::= So # ::std::basic_ostream - // > - // ::= Sd # ::std::basic_iostream - // > + // > ::= So # ::std::basic_ostream > ::= Sd # + // ::std::basic_iostream > bool ParseSubstitution() { const char *substitution; @@ -967,7 +960,8 @@ break; default: // A failed attempt to parse a number will return -1 which turns out to be - // perfect here as S_ is the first substitution, S0_ the next and so forth + // perfect here as S_ is the first substitution, S0_ the next and so + // forth int substitution_index = TryParseBase36Number(); if (*m_read_ptr++ != '_') { #ifdef DEBUG_FAILURES @@ -984,17 +978,17 @@ // ::= F [Y] [] E // - // ::= + # types are possible return - // type, then parameter types + // ::= + # types are possible + // return type, then parameter types bool ParseFunctionType(int inner_qualifiers = QualifierNone) { #ifdef DEBUG_FAILURES printf("*** Function types not supported\n"); #endif // TODO: first steps toward an implementation follow, but they're far - // from complete. Function types tend to bracket other types eg: - // int (*)() when used as the type for "name" becomes int (*name)(). - // This makes substitution et al ... interesting. + // from complete. Function types tend to bracket other types eg: int (*)() + // when used as the type for "name" becomes int (*name)(). This makes + // substitution et al ... interesting. return false; #if 0 // TODO @@ -1154,8 +1148,8 @@ if (!Parse('_')) return false; - // When no number is present we get -1, which is convenient since - // T_ is the zeroth element T0_ is element 1, and so on + // When no number is present we get -1, which is convenient since T_ is the + // zeroth element T0_ is element 1, and so on return RewriteTemplateArg(count + 1); } @@ -1193,13 +1187,13 @@ // ::= G # imaginary (C 2000) // ::= Dp # pack expansion (C++0x) // ::= U # vendor extended type qualifier - // extension := U # objc-type - // extension := # starts with Dv + // extension := U # objc-type extension + // := # starts with Dv // ::= objcproto # k0 = 9 + - // + k1 - // := # PU<11+>objcproto 11objc_object - // 11objc_object -> id + // + k1 := # + // PU<11+>objcproto 11objc_object 11objc_object -> id bool ParseType() { #ifdef DEBUG_FAILURES @@ -1476,8 +1470,8 @@ // ::= bool ParseUnqualifiedName(NameState &name_state) { - // Note that these are detected directly in ParseNestedName for - // performance rather than switching on the same options twice + // Note that these are detected directly in ParseNestedName for performance + // rather than switching on the same options twice char next = *m_read_ptr; switch (next) { case 'C': @@ -1943,7 +1937,8 @@ break; } - // Record a substitution candidate for all prefixes, but not the full name + // Record a substitution candidate for all prefixes, but not the full + // name if (suppress_substitution) suppress_substitution = false; else @@ -2247,9 +2242,9 @@ if (next == 'E' || next == '\0' || next == '.') return true; - // Clang has a bad habit of making unique manglings by just sticking numbers - // on the end of a symbol, - // which is ambiguous with malformed source name manglings + // Clang has a bad habit of making unique manglings by just sticking + // numbers on the end of a symbol, which is ambiguous with malformed source + // name manglings const char *before_clang_uniquing_test = m_read_ptr; if (TryParseNumber()) { if (*m_read_ptr == '\0') Index: lldb/trunk/source/Utility/FileSpec.cpp =================================================================== --- lldb/trunk/source/Utility/FileSpec.cpp +++ lldb/trunk/source/Utility/FileSpec.cpp @@ -166,8 +166,7 @@ FileSpec::FileSpec() : m_syntax(GetNativeSyntax()) {} //------------------------------------------------------------------ -// Default constructor that can take an optional full path to a -// file on disk. +// Default constructor that can take an optional full path to a file on disk. //------------------------------------------------------------------ FileSpec::FileSpec(llvm::StringRef path, bool resolve_path, PathSyntax syntax) : m_syntax(syntax) { @@ -307,15 +306,15 @@ } //------------------------------------------------------------------ -// Update the contents of this object with a new path. The path will -// be split up into a directory and filename and stored as uniqued -// string values for quick comparison and efficient memory usage. +// Update the contents of this object with a new path. The path will be split +// up into a directory and filename and stored as uniqued string values for +// quick comparison and efficient memory usage. //------------------------------------------------------------------ void FileSpec::SetFile(llvm::StringRef pathname, bool resolve, PathSyntax syntax) { // CLEANUP: Use StringRef for string handling. This function is kind of a - // mess and the unclear semantics of RootDirStart and ParentPathEnd make - // it very difficult to understand this function. There's no reason this + // mess and the unclear semantics of RootDirStart and ParentPathEnd make it + // very difficult to understand this function. There's no reason this // function should be particularly complicated or difficult to understand. m_filename.Clear(); m_directory.Clear(); @@ -369,8 +368,8 @@ } //---------------------------------------------------------------------- -// Convert to pointer operator. This allows code to check any FileSpec -// objects to see if they contain anything valid using code such as: +// Convert to pointer operator. This allows code to check any FileSpec objects +// to see if they contain anything valid using code such as: // // if (file_spec) // {} @@ -378,8 +377,8 @@ FileSpec::operator bool() const { return m_filename || m_directory; } //---------------------------------------------------------------------- -// Logical NOT operator. This allows code to check any FileSpec -// objects to see if they are invalid using code such as: +// Logical NOT operator. This allows code to check any FileSpec objects to see +// if they are invalid using code such as: // // if (!file_spec) // {} @@ -406,12 +405,10 @@ return true; // TODO: determine if we want to keep this code in here. - // The code below was added to handle a case where we were - // trying to set a file and line breakpoint and one path - // was resolved, and the other not and the directory was - // in a mount point that resolved to a more complete path: - // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling - // this out... + // The code below was added to handle a case where we were trying to set a + // file and line breakpoint and one path was resolved, and the other not and + // the directory was in a mount point that resolved to a more complete path: + // "/tmp/a.c" == "/private/tmp/a.c". I might end up pulling this out... if (IsResolved() && rhs.IsResolved()) { // Both paths are resolved, no need to look further... return false; @@ -423,8 +420,8 @@ if (!IsResolved()) { if (resolved_lhs.ResolvePath()) { // This path wasn't resolved but now it is. Check if the resolved - // directory is the same as our unresolved directory, and if so, - // we can mark this object as resolved to avoid more future resolves + // directory is the same as our unresolved directory, and if so, we can + // mark this object as resolved to avoid more future resolves m_is_resolved = (m_directory == resolved_lhs.m_directory); } else return false; @@ -434,16 +431,16 @@ if (!rhs.IsResolved()) { if (resolved_rhs.ResolvePath()) { // rhs's path wasn't resolved but now it is. Check if the resolved - // directory is the same as rhs's unresolved directory, and if so, - // we can mark this object as resolved to avoid more future resolves + // directory is the same as rhs's unresolved directory, and if so, we can + // mark this object as resolved to avoid more future resolves rhs.m_is_resolved = (rhs.m_directory == resolved_rhs.m_directory); } else return false; } - // If we reach this point in the code we were able to resolve both paths - // and since we only resolve the paths if the basenames are equal, then - // we can just check if both directories are equal... + // If we reach this point in the code we were able to resolve both paths and + // since we only resolve the paths if the basenames are equal, then we can + // just check if both directories are equal... return DirectoryEquals(rhs); } @@ -468,8 +465,8 @@ } //------------------------------------------------------------------ -// Clear this object by releasing both the directory and filename -// string values and making them both the empty string. +// Clear this object by releasing both the directory and filename string values +// and making them both the empty string. //------------------------------------------------------------------ void FileSpec::Clear() { m_directory.Clear(); @@ -477,15 +474,14 @@ } //------------------------------------------------------------------ -// Compare two FileSpec objects. If "full" is true, then both -// the directory and the filename must match. If "full" is false, -// then the directory names for "a" and "b" are only compared if -// they are both non-empty. This allows a FileSpec object to only -// contain a filename and it can match FileSpec objects that have -// matching filenames with different paths. +// Compare two FileSpec objects. If "full" is true, then both the directory and +// the filename must match. If "full" is false, then the directory names for +// "a" and "b" are only compared if they are both non-empty. This allows a +// FileSpec object to only contain a filename and it can match FileSpec objects +// that have matching filenames with different paths. // -// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b" -// and "1" if "a" is greater than "b". +// Return -1 if the "a" is less than "b", 0 if "a" is equal to "b" and "1" if +// "a" is greater than "b". //------------------------------------------------------------------ int FileSpec::Compare(const FileSpec &a, const FileSpec &b, bool full) { int result = 0; @@ -495,10 +491,10 @@ // If full is true, then we must compare both the directory and filename. - // If full is false, then if either directory is empty, then we match on - // the basename only, and if both directories have valid values, we still - // do a full compare. This allows for matching when we just have a filename - // in one of the FileSpec objects. + // If full is false, then if either directory is empty, then we match on the + // basename only, and if both directories have valid values, we still do a + // full compare. This allows for matching when we just have a filename in one + // of the FileSpec objects. if (full || (a.m_directory && b.m_directory)) { result = ConstString::Compare(a.m_directory, b.m_directory, case_sensitive); @@ -527,9 +523,9 @@ } //------------------------------------------------------------------ -// Dump the object to the supplied stream. If the object contains -// a valid directory name, it will be displayed followed by a -// directory delimiter, and the filename. +// Dump the object to the supplied stream. If the object contains a valid +// directory name, it will be displayed followed by a directory delimiter, and +// the filename. //------------------------------------------------------------------ void FileSpec::Dump(Stream *s) const { if (s) { @@ -572,8 +568,7 @@ return true; else { // If FindProgramByName found the file, it returns the directory + - // filename in its return results. - // We need to separate them. + // filename in its return results. We need to separate them. FileSpec tmp_file(dir_ref.data(), false); if (tmp_file.Exists()) { m_directory = tmp_file.m_directory; @@ -635,9 +630,8 @@ const ConstString &FileSpec::GetFilename() const { return m_filename; } //------------------------------------------------------------------ -// Extract the directory and path into a fixed buffer. This is -// needed as the directory and path are stored in separate string -// values. +// Extract the directory and path into a fixed buffer. This is needed as the +// directory and path are stored in separate string values. //------------------------------------------------------------------ size_t FileSpec::GetPath(char *path, size_t path_max_len, bool denormalize) const { @@ -698,9 +692,8 @@ } //------------------------------------------------------------------ -// Return the size in bytes that this object takes in memory. This -// returns the size in bytes of this object, not any shared string -// values it may refer to. +// Return the size in bytes that this object takes in memory. This returns the +// size in bytes of this object, not any shared string values it may refer to. //------------------------------------------------------------------ size_t FileSpec::MemorySize() const { return m_filename.MemorySize() + m_directory.MemorySize(); @@ -961,10 +954,9 @@ // Style is either D or empty, either way we need to print the directory. if (!dir.empty()) { - // Directory is stored in normalized form, which might be different - // than preferred form. In order to handle this, we need to cut off - // the filename, then denormalize, then write the entire denorm'ed - // directory. + // Directory is stored in normalized form, which might be different than + // preferred form. In order to handle this, we need to cut off the + // filename, then denormalize, then write the entire denorm'ed directory. llvm::SmallString<64> denormalized_dir = dir; Denormalize(denormalized_dir, F.GetPathSyntax()); Stream << denormalized_dir; Index: lldb/trunk/source/Utility/JSON.cpp =================================================================== --- lldb/trunk/source/Utility/JSON.cpp +++ lldb/trunk/source/Utility/JSON.cpp @@ -449,8 +449,7 @@ JSONValue::SP JSONParser::ParseJSONObject() { // The "JSONParser::Token::ObjectStart" token should have already been - // consumed - // by the time this function is called + // consumed by the time this function is called std::unique_ptr dict_up(new JSONObject()); std::string value; @@ -481,8 +480,7 @@ JSONValue::SP JSONParser::ParseJSONArray() { // The "JSONParser::Token::ObjectStart" token should have already been - // consumed - // by the time this function is called + // consumed by the time this function is called std::unique_ptr array_up(new JSONArray()); std::string value; Index: lldb/trunk/source/Utility/Log.cpp =================================================================== --- lldb/trunk/source/Utility/Log.cpp +++ lldb/trunk/source/Utility/Log.cpp @@ -121,9 +121,9 @@ } //---------------------------------------------------------------------- -// All logging eventually boils down to this function call. If we have -// a callback registered, then we call the logging callback. If we have -// a valid file handle, we also log to the file. +// All logging eventually boils down to this function call. If we have a +// callback registered, then we call the logging callback. If we have a valid +// file handle, we also log to the file. //---------------------------------------------------------------------- void Log::VAPrintf(const char *format, va_list args) { llvm::SmallString<64> FinalMessage; @@ -156,8 +156,7 @@ } //---------------------------------------------------------------------- -// Printing of warnings that are not fatal only if verbose mode is -// enabled. +// Printing of warnings that are not fatal only if verbose mode is enabled. //---------------------------------------------------------------------- void Log::Verbose(const char *format, ...) { if (!GetVerbose()) @@ -302,8 +301,8 @@ } void Log::WriteMessage(const std::string &message) { - // Make a copy of our stream shared pointer in case someone disables our - // log while we are logging and releases the stream + // Make a copy of our stream shared pointer in case someone disables our log + // while we are logging and releases the stream auto stream_sp = GetStream(); if (!stream_sp) return; Index: lldb/trunk/source/Utility/RegularExpression.cpp =================================================================== --- lldb/trunk/source/Utility/RegularExpression.cpp +++ lldb/trunk/source/Utility/RegularExpression.cpp @@ -14,9 +14,8 @@ #include //---------------------------------------------------------------------- -// Enable enhanced mode if it is available. This allows for things like -// \d for digit, \s for space, and many more, but it isn't available -// everywhere. +// Enable enhanced mode if it is available. This allows for things like \d for +// digit, \s for space, and many more, but it isn't available everywhere. //---------------------------------------------------------------------- #if defined(REG_ENHANCED) #define DEFAULT_COMPILE_FLAGS (REG_ENHANCED | REG_EXTENDED) @@ -31,8 +30,8 @@ } //---------------------------------------------------------------------- -// Constructor that compiles "re" using "flags" and stores the -// resulting compiled regular expression into this object. +// Constructor that compiles "re" using "flags" and stores the resulting +// compiled regular expression into this object. //---------------------------------------------------------------------- RegularExpression::RegularExpression(llvm::StringRef str) : m_re(), m_comp_err(1), m_preg() { @@ -55,17 +54,16 @@ //---------------------------------------------------------------------- // Destructor // -// Any previously compiled regular expression contained in this -// object will be freed. +// Any previously compiled regular expression contained in this object will be +// freed. //---------------------------------------------------------------------- RegularExpression::~RegularExpression() { Free(); } //---------------------------------------------------------------------- -// Compile a regular expression using the supplied regular -// expression text and flags. The compiled regular expression lives -// in this object so that it can be readily used for regular -// expression matches. Execute() can be called after the regular -// expression is compiled. Any previously compiled regular +// Compile a regular expression using the supplied regular expression text and +// flags. The compiled regular expression lives in this object so that it can +// be readily used for regular expression matches. Execute() can be called +// after the regular expression is compiled. Any previously compiled regular // expression contained in this object will be freed. // // RETURNS @@ -75,20 +73,19 @@ bool RegularExpression::Compile(llvm::StringRef str) { Free(); - // regcomp() on darwin does not recognize "" as a valid regular expression, so - // we substitute it with an equivalent non-empty one. + // regcomp() on darwin does not recognize "" as a valid regular expression, + // so we substitute it with an equivalent non-empty one. m_re = str.empty() ? "()" : str; m_comp_err = ::regcomp(&m_preg, m_re.c_str(), DEFAULT_COMPILE_FLAGS); return m_comp_err == 0; } //---------------------------------------------------------------------- -// Execute a regular expression match using the compiled regular -// expression that is already in this object against the match -// string "s". If any parens are used for regular expression -// matches "match_count" should indicate the number of regmatch_t -// values that are present in "match_ptr". The regular expression -// will be executed using the "execute_flags". +// Execute a regular expression match using the compiled regular expression +// that is already in this object against the match string "s". If any parens +// are used for regular expression matches "match_count" should indicate the +// number of regmatch_t values that are present in "match_ptr". The regular +// expression will be executed using the "execute_flags". //--------------------------------------------------------------------- bool RegularExpression::Execute(llvm::StringRef str, Match *match) const { int err = 1; @@ -159,14 +156,12 @@ } //---------------------------------------------------------------------- -// Returns true if the regular expression compiled and is ready -// for execution. +// Returns true if the regular expression compiled and is ready for execution. //---------------------------------------------------------------------- bool RegularExpression::IsValid() const { return m_comp_err == 0; } //---------------------------------------------------------------------- -// Returns the text that was used to compile the current regular -// expression. +// Returns the text that was used to compile the current regular expression. //---------------------------------------------------------------------- llvm::StringRef RegularExpression::GetText() const { return m_re; } Index: lldb/trunk/source/Utility/SelectHelper.cpp =================================================================== --- lldb/trunk/source/Utility/SelectHelper.cpp +++ lldb/trunk/source/Utility/SelectHelper.cpp @@ -236,8 +236,9 @@ error.SetErrorString("timed out"); return error; } else { - // One or more descriptors were set, update the FDInfo::select_is_set mask - // so users can ask the SelectHelper class so clients can call one of: + // One or more descriptors were set, update the FDInfo::select_is_set + // mask so users can ask the SelectHelper class so clients can call one + // of: for (auto &pair : m_fd_map) { const int fd = pair.first; Index: lldb/trunk/source/Utility/SharingPtr.cpp =================================================================== --- lldb/trunk/source/Utility/SharingPtr.cpp +++ lldb/trunk/source/Utility/SharingPtr.cpp @@ -11,8 +11,8 @@ #if defined(ENABLE_SP_LOGGING) -// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments -// and allow them to be queried using a pointer by a call to: +// If ENABLE_SP_LOGGING is defined, then log all shared pointer assignments and +// allow them to be queried using a pointer by a call to: #include #include @@ -96,8 +96,8 @@ namespace lldb { void dump_sp_refs(void *ptr) { - // Use a specially crafted call to "track_sp" which will - // dump info on all live shared pointers that reference "ptr" + // Use a specially crafted call to "track_sp" which will dump info on all + // live shared pointers that reference "ptr" track_sp(NULL, ptr, 0); } } Index: lldb/trunk/source/Utility/Status.cpp =================================================================== --- lldb/trunk/source/Utility/Status.cpp +++ lldb/trunk/source/Utility/Status.cpp @@ -107,9 +107,9 @@ Status::~Status() = default; //---------------------------------------------------------------------- -// Get the error value as a NULL C string. The error string will be -// fetched and cached on demand. The cached error string value will -// remain until the error value is changed or cleared. +// Get the error value as a NULL C string. The error string will be fetched and +// cached on demand. The cached error string value will remain until the error +// value is changed or cleared. //---------------------------------------------------------------------- const char *Status::AsCString(const char *default_error_str) const { if (Success()) @@ -161,8 +161,8 @@ ErrorType Status::GetType() const { return m_type; } //---------------------------------------------------------------------- -// Returns true if this object contains a value that describes an -// error or otherwise non-success result. +// Returns true if this object contains a value that describes an error or +// otherwise non-success result. //---------------------------------------------------------------------- bool Status::Fail() const { return m_code != 0; } @@ -210,8 +210,7 @@ } //---------------------------------------------------------------------- -// Update the error value to be "errno" and update the type to -// be "POSIX". +// Update the error value to be "errno" and update the type to be "POSIX". //---------------------------------------------------------------------- void Status::SetErrorToErrno() { m_code = errno; @@ -220,8 +219,8 @@ } //---------------------------------------------------------------------- -// Update the error value to be LLDB_GENERIC_ERROR and update the type -// to be "Generic". +// Update the error value to be LLDB_GENERIC_ERROR and update the type to be +// "Generic". //---------------------------------------------------------------------- void Status::SetErrorToGenericError() { m_code = LLDB_GENERIC_ERROR; @@ -230,15 +229,15 @@ } //---------------------------------------------------------------------- -// Set accessor for the error string value for a specific error. -// This allows any string to be supplied as an error explanation. -// The error string value will remain until the error value is -// cleared or a new error value/type is assigned. +// Set accessor for the error string value for a specific error. This allows +// any string to be supplied as an error explanation. The error string value +// will remain until the error value is cleared or a new error value/type is +// assigned. //---------------------------------------------------------------------- void Status::SetErrorString(llvm::StringRef err_str) { if (!err_str.empty()) { - // If we have an error string, we should always at least have an error - // set to a generic value. + // If we have an error string, we should always at least have an error set + // to a generic value. if (Success()) SetErrorToGenericError(); } @@ -266,8 +265,8 @@ int Status::SetErrorStringWithVarArg(const char *format, va_list args) { if (format != nullptr && format[0]) { - // If we have an error string, we should always at least have - // an error set to a generic value. + // If we have an error string, we should always at least have an error set + // to a generic value. if (Success()) SetErrorToGenericError(); @@ -282,8 +281,8 @@ } //---------------------------------------------------------------------- -// Returns true if the error code in this object is considered a -// successful return value. +// Returns true if the error code in this object is considered a successful +// return value. //---------------------------------------------------------------------- bool Status::Success() const { return m_code == 0; } Index: lldb/trunk/source/Utility/Stream.cpp =================================================================== --- lldb/trunk/source/Utility/Stream.cpp +++ lldb/trunk/source/Utility/Stream.cpp @@ -41,14 +41,12 @@ } //------------------------------------------------------------------ -// Put an offset "uval" out to the stream using the printf format -// in "format". +// Put an offset "uval" out to the stream using the printf format in "format". //------------------------------------------------------------------ void Stream::Offset(uint32_t uval, const char *format) { Printf(format, uval); } //------------------------------------------------------------------ -// Put an SLEB128 "uval" out to the stream using the printf format -// in "format". +// Put an SLEB128 "uval" out to the stream using the printf format in "format". //------------------------------------------------------------------ size_t Stream::PutSLEB128(int64_t sval) { size_t bytes_written = 0; @@ -73,8 +71,7 @@ } //------------------------------------------------------------------ -// Put an ULEB128 "uval" out to the stream using the printf format -// in "format". +// Put an ULEB128 "uval" out to the stream using the printf format in "format". //------------------------------------------------------------------ size_t Stream::PutULEB128(uint64_t uval) { size_t bytes_written = 0; @@ -109,16 +106,16 @@ } //------------------------------------------------------------------ -// Print a double quoted NULL terminated C string to the stream -// using the printf format in "format". +// Print a double quoted NULL terminated C string to the stream using the +// printf format in "format". //------------------------------------------------------------------ void Stream::QuotedCString(const char *cstr, const char *format) { Printf(format, cstr); } //------------------------------------------------------------------ -// Put an address "addr" out to the stream with optional prefix -// and suffix strings. +// Put an address "addr" out to the stream with optional prefix and suffix +// strings. //------------------------------------------------------------------ void Stream::Address(uint64_t addr, uint32_t addr_size, const char *prefix, const char *suffix) { @@ -132,8 +129,8 @@ } //------------------------------------------------------------------ -// Put an address range out to the stream with optional prefix -// and suffix strings. +// Put an address range out to the stream with optional prefix and suffix +// strings. //------------------------------------------------------------------ void Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix, @@ -179,8 +176,8 @@ size_t Stream::EOL() { return PutChar('\n'); } //------------------------------------------------------------------ -// Indent the current line using the current indentation level and -// print an optional string following the indentation spaces. +// Indent the current line using the current indentation level and print an +// optional string following the indentation spaces. //------------------------------------------------------------------ size_t Stream::Indent(const char *s) { return Printf("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : ""); Index: lldb/trunk/source/Utility/StringExtractor.cpp =================================================================== --- lldb/trunk/source/Utility/StringExtractor.cpp +++ lldb/trunk/source/Utility/StringExtractor.cpp @@ -74,9 +74,8 @@ } //---------------------------------------------------------------------- -// If a pair of valid hex digits exist at the head of the -// StringExtractor they are decoded into an unsigned byte and returned -// by this function +// If a pair of valid hex digits exist at the head of the StringExtractor they +// are decoded into an unsigned byte and returned by this function // // If there is not a pair of valid hex digits at the head of the // StringExtractor, it is left unchanged and -1 is returned @@ -96,12 +95,12 @@ } //---------------------------------------------------------------------- -// Extract an unsigned character from two hex ASCII chars in the packet -// string, or return fail_value on failure +// Extract an unsigned character from two hex ASCII chars in the packet string, +// or return fail_value on failure //---------------------------------------------------------------------- uint8_t StringExtractor::GetHexU8(uint8_t fail_value, bool set_eof_on_fail) { - // On success, fail_value will be overwritten with the next - // character in the stream + // On success, fail_value will be overwritten with the next character in the + // stream GetHexU8Ex(fail_value, set_eof_on_fail); return fail_value; } @@ -307,8 +306,8 @@ } //---------------------------------------------------------------------- -// Decodes all valid hex encoded bytes at the head of the -// StringExtractor, limited by dst_len. +// Decodes all valid hex encoded bytes at the head of the StringExtractor, +// limited by dst_len. // // Returns the number of bytes successfully decoded //---------------------------------------------------------------------- @@ -390,9 +389,9 @@ bool StringExtractor::GetNameColonValue(llvm::StringRef &name, llvm::StringRef &value) { - // Read something in the form of NNNN:VVVV; where NNNN is any character - // that is not a colon, followed by a ':' character, then a value (one or - // more ';' chars), followed by a ';' + // Read something in the form of NNNN:VVVV; where NNNN is any character that + // is not a colon, followed by a ':' character, then a value (one or more ';' + // chars), followed by a ';' if (m_index >= m_packet.size()) return fail(); Index: lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp =================================================================== --- lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp +++ lldb/trunk/source/Utility/StringExtractorGDBRemote.cpp @@ -482,10 +482,9 @@ size_t StringExtractorGDBRemote::GetEscapedBinaryData(std::string &str) { // Just get the data bytes in the string as - // GDBRemoteCommunication::CheckForPacket() - // already removes any 0x7d escaped characters. If any 0x7d characters are - // left in - // the packet, then they are supposed to be there... + // GDBRemoteCommunication::CheckForPacket() already removes any 0x7d escaped + // characters. If any 0x7d characters are left in the packet, then they are + // supposed to be there... str.clear(); const size_t bytes_left = GetBytesLeft(); if (bytes_left > 0) { @@ -526,9 +525,9 @@ case StringExtractorGDBRemote::eResponse: // JSON that is returned in from JSON query packets is currently always - // either a dictionary which starts with a '{', or an array which - // starts with a '['. This is a quick validator to just make sure the - // response could be valid JSON without having to validate all of the + // either a dictionary which starts with a '{', or an array which starts + // with a '['. This is a quick validator to just make sure the response + // could be valid JSON without having to validate all of the // JSON content. switch (response.GetStringRef()[0]) { case '{': Index: lldb/trunk/source/Utility/StructuredData.cpp =================================================================== --- lldb/trunk/source/Utility/StructuredData.cpp +++ lldb/trunk/source/Utility/StructuredData.cpp @@ -85,8 +85,7 @@ static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser) { // The "JSONParser::Token::ObjectStart" token should have already been - // consumed - // by the time this function is called + // consumed by the time this function is called auto array_up = llvm::make_unique(); std::string value; @@ -162,8 +161,8 @@ std::string key = match.first.str(); ObjectSP value = this->GetAsDictionary()->GetValueForKey(key); if (value.get()) { - // Do we have additional words to descend? If not, return the - // value we're at right now. + // Do we have additional words to descend? If not, return the value + // we're at right now. if (match.second.empty()) { return value; } else { Index: lldb/trunk/source/Utility/UUID.cpp =================================================================== --- lldb/trunk/source/Utility/UUID.cpp +++ lldb/trunk/source/Utility/UUID.cpp @@ -133,8 +133,8 @@ // Skip both hex digits p = p.drop_front(2); - // Increment the byte that we are decoding within the UUID value - // and break out if we are done + // Increment the byte that we are decoding within the UUID value and + // break out if we are done if (++uuid_byte_idx == num_uuid_bytes) break; } else if (p.front() == '-') { Index: lldb/trunk/source/Utility/VASprintf.cpp =================================================================== --- lldb/trunk/source/Utility/VASprintf.cpp +++ lldb/trunk/source/Utility/VASprintf.cpp @@ -36,8 +36,8 @@ } if (size_t(length) >= buf.size()) { - // The error formatted string didn't fit into our buffer, resize it - // to the exact needed size, and retry + // The error formatted string didn't fit into our buffer, resize it to the + // exact needed size, and retry buf.resize(length + 1); length = ::vsnprintf(buf.data(), buf.size(), fmt, copy_args); if (length < 0) {