diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
commit | 05097246f352eca76207c9ebb08656c88bdf751a (patch) | |
tree | bfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Commands | |
parent | add59c052dd6768fd54431e6a3bf045e7f25cb59 (diff) | |
download | llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.bz2 |
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit
(r280751), which unfortunately resulted in many of the comment
paragraphs in LLDB being very hard to read.
FYI, the script I used was:
import textwrap
import commands
import os
import sys
import re
tmp = "%s.tmp"%sys.argv[1]
out = open(tmp, "w+")
with open(sys.argv[1], "r") as f:
header = ""
text = ""
comment = re.compile(r'^( *//) ([^ ].*)$')
special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$')
for line in f:
match = comment.match(line)
if match and not special.match(match.group(2)):
# skip intentionally short comments.
if not text and len(match.group(2)) < 40:
out.write(line)
continue
if text:
text += " " + match.group(2)
else:
header = match.group(1)
text = match.group(2)
continue
if text:
filled = textwrap.wrap(text, width=(78-len(header)),
break_long_words=False)
for l in filled:
out.write(header+" "+l+'\n')
text = ""
out.write(line)
os.rename(tmp, sys.argv[1])
Differential Revision: https://reviews.llvm.org/D46144
llvm-svn: 331197
Diffstat (limited to 'lldb/source/Commands')
22 files changed, 296 insertions, 358 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 49c79e9..b141833 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -149,8 +149,8 @@ static int DiskFilesOrDirectories(const llvm::Twine &partial_name, 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. diff --git a/lldb/source/Commands/CommandObjectApropos.cpp b/lldb/source/Commands/CommandObjectApropos.cpp index 43a1889..0475752 100644 --- a/lldb/source/Commands/CommandObjectApropos.cpp +++ b/lldb/source/Commands/CommandObjectApropos.cpp @@ -53,8 +53,8 @@ bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) { 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; diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index b0193b67..838759d 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -85,8 +85,8 @@ public: 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 @@ static OptionDefinition g_breakpoint_set_options[] = { "#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, "<column>", // "Set the breakpoint by source location at this particular column."}, @@ -854,9 +855,9 @@ protected: 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 @@ private: 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 @@ protected: 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 @@ protected: 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 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(Args &args, Target *target, } // 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 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(Args &args, Target *target, 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) { diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp index 95a17db..f2546cb 100644 --- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp @@ -412,8 +412,8 @@ protected: } 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 @@ protected: } } - // 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 @@ private: std::vector<BreakpointOptions *> 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; }; diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 500e217..454efd1 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -331,9 +331,8 @@ protected: 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 @@ protected: } // 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 @@ protected: 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 @@ protected: 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/<regex>/<subst>/" or "s|<regex>|<subst>|" + // use the char that follows 's' as the regex separator character so we can + // have "s/<regex>/<subst>/" or "s|<regex>|<subst>|" 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 @@ protected: } 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 @@ protected: // 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)) { diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index f360a32..497a9b7 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -126,8 +126,8 @@ Status CommandObjectDisassemble::CommandOptions::SetOptionValue( 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 @@ void CommandObjectDisassemble::CommandOptions::OptionParsingStarting( 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 @@ bool CommandObjectDisassemble::DoExecute(Args &command, } } - // 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) { diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index fc62b39..9fe00f4 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -322,9 +322,9 @@ bool CommandObjectExpression::EvaluateExpression(const char *expr, 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 @@ bool CommandObjectExpression::EvaluateExpression(const char *expr, 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 @@ bool CommandObjectExpression::IOHandlerIsInputComplete(IOHandler &io_handler, // 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 @@ bool CommandObjectExpression::DoExecute(const char *command, 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 @@ bool CommandObjectExpression::DoExecute(const char *command, } 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; diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp index d1ca460..f4bce6e 100644 --- a/lldb/source/Commands/CommandObjectFrame.cpp +++ b/lldb/source/Commands/CommandObjectFrame.cpp @@ -342,8 +342,8 @@ protected: 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 @@ protected: } 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 @@ protected: 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 @@ protected: 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() && diff --git a/lldb/source/Commands/CommandObjectHelp.cpp b/lldb/source/Commands/CommandObjectHelp.cpp index 99e9d7b..d379c62 100644 --- a/lldb/source/Commands/CommandObjectHelp.cpp +++ b/lldb/source/Commands/CommandObjectHelp.cpp @@ -89,10 +89,9 @@ bool CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) { 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 @@ int CommandObjectHelp::HandleCompletion(Args &input, int &cursor_index, 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(); diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index e882b7f..a77c415 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -554,8 +554,8 @@ protected: 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 @@ protected: // 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 @@ protected: 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); diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp index 0d0aa10..44a1320 100644 --- a/lldb/source/Commands/CommandObjectMultiword.cpp +++ b/lldb/source/Commands/CommandObjectMultiword.cpp @@ -55,8 +55,7 @@ CommandObjectSP CommandObjectMultiword::GetSubcommandSP(llvm::StringRef sub_cmd, 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 @@ bool CommandObjectMultiword::Execute(const char *args_string, 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 @@ bool CommandObjectMultiword::Execute(const char *args_string, } 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"); diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index c351428..379e850 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -385,8 +385,8 @@ protected: 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 @@ public: // 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 @@ protected: 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 @@ public: // 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); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index da51109..cfb370d0 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -180,18 +180,18 @@ protected: 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 @@ protected: 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 @@ public: // 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 @@ protected: 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 @@ protected: } // 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 @@ protected: 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 @@ protected: 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 @@ protected: 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) { diff --git a/lldb/source/Commands/CommandObjectQuit.cpp b/lldb/source/Commands/CommandObjectQuit.cpp index be55dab..071deba 100644 --- a/lldb/source/Commands/CommandObjectQuit.cpp +++ b/lldb/source/Commands/CommandObjectQuit.cpp @@ -30,10 +30,9 @@ CommandObjectQuit::CommandObjectQuit(CommandInterpreter &interpreter) 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; diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp index 5647142..193729e 100644 --- a/lldb/source/Commands/CommandObjectRegister.cpp +++ b/lldb/source/Commands/CommandObjectRegister.cpp @@ -192,8 +192,8 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: 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; diff --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp index 50a3fe2..b1b0ae8 100644 --- a/lldb/source/Commands/CommandObjectSettings.cpp +++ b/lldb/source/Commands/CommandObjectSettings.cpp @@ -220,10 +220,8 @@ protected: 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 @@ protected: 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); diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 7f2b9f0..19e2e44 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -148,16 +148,13 @@ public: 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 @@ protected: } // 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: } // 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 @@ protected: 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 @@ protected: " 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 @@ protected: 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 @@ public: 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 @@ protected: } // 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: } } } 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, diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 12d322b..45204b6 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -274,10 +274,8 @@ protected: 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 @@ protected: &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 @@ protected: 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 @@ public: 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 @@ public: 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 @@ static size_t LookupTypeInModule(CommandInterpreter &interpreter, Stream &strm, 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 @@ static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm, 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 @@ static size_t FindModulesByName(Target *target, const char *module_name, 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 @@ protected: 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 @@ protected: 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 @@ protected: 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<std::recursive_mutex> guard( Module::GetAllocationModuleCollectionMutex(), std::defer_lock); @@ -3831,9 +3823,9 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: } } - // 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 @@ protected: 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 @@ protected: } else if (num_matches == 1) { ModuleSP module_sp(matching_module_list.GetModuleAtIndex(0)); - // The module has not yet created its symbol vendor, we can just - // give the existing target module the symfile path to use for - // when it decides to create it! + // 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 @@ protected: "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); diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 43c5c54..a9a277e 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -104,8 +104,8 @@ public: } // 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<lldb::tid_t> tids; if (all_threads || m_unique_stacks) { @@ -196,11 +196,10 @@ protected: // // 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 @@ protected: 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 @@ protected: } // 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 @@ protected: } // 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 @@ public: (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<std::recursive_mutex> guard( process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); @@ -931,9 +928,9 @@ public: 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<std::recursive_mutex> guard( process->GetThreadList().GetMutex()); const uint32_t num_threads = process->GetThreadList().GetSize(); @@ -1195,8 +1192,8 @@ protected: 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 @@ protected: 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 { diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 87ce47f..7339307 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -1421,8 +1421,8 @@ bool CommandObjectTypeSummaryAdd::Execute_ScriptSummary( 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 @@ static OptionDefinition g_type_lookup_options[] = { 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 @@ public: } // 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) { diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp index 9c84c992..f0653be3 100644 --- a/lldb/source/Commands/CommandObjectWatchpoint.cpp +++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp @@ -74,8 +74,8 @@ static int32_t WithRSAIndex(llvm::StringRef Arg) { 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<uint32_t> &wp_ids) { // Pre-condition: args.GetArgumentCount() > 0. @@ -111,8 +111,8 @@ bool CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs( 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 @@ protected: 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 @@ protected: 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 @@ protected: 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 @@ protected: 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; diff --git a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp index eda81a6..9561cb1 100644 --- a/lldb/source/Commands/CommandObjectWatchpointCommand.cpp +++ b/lldb/source/Commands/CommandObjectWatchpointCommand.cpp @@ -254,11 +254,10 @@ are no syntax errors may indicate that a function was declared but never called. std::unique_ptr<WatchpointOptions::CommandData> 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 @@ are no syntax errors may indicate that a function was declared but never called. 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 @@ protected: 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)"; |