diff options
Diffstat (limited to 'tools/llvm-db')
-rw-r--r-- | tools/llvm-db/CLICommand.h | 8 | ||||
-rw-r--r-- | tools/llvm-db/CLIDebugger.cpp | 28 | ||||
-rw-r--r-- | tools/llvm-db/CLIDebugger.h | 8 | ||||
-rw-r--r-- | tools/llvm-db/Commands.cpp | 34 | ||||
-rw-r--r-- | tools/llvm-db/llvm-db.cpp | 8 |
5 files changed, 43 insertions, 43 deletions
diff --git a/tools/llvm-db/CLICommand.h b/tools/llvm-db/CLICommand.h index ad8b8403bd..0b60e05212 100644 --- a/tools/llvm-db/CLICommand.h +++ b/tools/llvm-db/CLICommand.h @@ -1,10 +1,10 @@ //===- CLICommand.h - Classes used to represent commands --------*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines a small class hierarchy used to represent the various types @@ -74,7 +74,7 @@ namespace llvm { /// removeOptionName - Eliminate one of the names for this option. /// void removeOptionName(const std::string &Name) { - unsigned i = 0; + unsigned i = 0; for (; OptionNames[i] != Name; ++i) assert(i+1 < OptionNames.size() && "Didn't find option name!"); OptionNames.erase(OptionNames.begin()+i); @@ -101,7 +101,7 @@ namespace llvm { BuiltinCLICommand(const std::string &ShortHelp, const std::string &LongHelp, void (CLIDebugger::*impl)(std::string&)) : CLICommand(ShortHelp, LongHelp), Impl(impl) {} - + void runCommand(CLIDebugger &D, std::string &Arguments) { (D.*Impl)(Arguments); } diff --git a/tools/llvm-db/CLIDebugger.cpp b/tools/llvm-db/CLIDebugger.cpp index 4e36bbf6de..e7ab75c387 100644 --- a/tools/llvm-db/CLIDebugger.cpp +++ b/tools/llvm-db/CLIDebugger.cpp @@ -1,12 +1,12 @@ //===-- CLIDebugger.cpp - Command Line Interface to the Debugger ----------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // This file contains the main implementation of the Command Line Interface to // the debugger. // @@ -77,7 +77,7 @@ CLIDebugger::CLIDebugger() addCommand("next", C = new BuiltinCLICommand( "Step program until it reaches a new source line, stepping over calls", "", &CLIDebugger::nextCommand)); - addCommand("n", C); + addCommand("n", C); addCommand("finish", new BuiltinCLICommand( "Execute until the selected stack frame returns", @@ -91,8 +91,8 @@ CLIDebugger::CLIDebugger() "Print backtrace of all stack frames, or innermost COUNT frames", "FIXME: describe. Takes 'n', '-n' or 'full'\n", &CLIDebugger::backtraceCommand)); - addCommand("bt", C); - + addCommand("bt", C); + addCommand("up", new BuiltinCLICommand( "Select and print stack frame that called this one", "An argument says how many frames up to go.\n", @@ -108,7 +108,7 @@ CLIDebugger::CLIDebugger() "With no argument, print the selected stack frame. (See also 'info frame').\n" "An argument specifies the frame to select.\n", &CLIDebugger::frameCommand)); - addCommand("f", C); + addCommand("f", C); //===--------------------------------------------------------------------===// // Breakpoint related commands @@ -117,7 +117,7 @@ CLIDebugger::CLIDebugger() "Set breakpoint at specified line or function", "FIXME: describe.\n", &CLIDebugger::breakCommand)); - addCommand("b", C); + addCommand("b", C); //===--------------------------------------------------------------------===// @@ -187,7 +187,7 @@ CLICommand *CLIDebugger::getCommand(const std::string &Command) { // Look up the command in the table. std::map<std::string, CLICommand*>::iterator CI = CommandTable.lower_bound(Command); - + if (Command == "") { throw "Null command should not get here!"; } else if (CI == CommandTable.end() || @@ -207,7 +207,7 @@ CLICommand *CLIDebugger::getCommand(const std::string &Command) { // If the next command is a valid completion of this one, we are // ambiguous. if (++CI2 != CommandTable.end() && isValidPrefix(Command, CI2->first)) { - std::string ErrorMsg = + std::string ErrorMsg = "Ambiguous command '" + Command + "'. Options: " + CI->first; for (++CI; CI != CommandTable.end() && isValidPrefix(Command, CI->first); ++CI) @@ -242,7 +242,7 @@ int CLIDebugger::run() { try { CLICommand *CurCommand; - + if (Command == "") { CurCommand = LastCommand; Arguments = LastArgs; @@ -257,7 +257,7 @@ int CLIDebugger::run() { // Finally, execute the command. if (CurCommand) - CurCommand->runCommand(*this, Arguments); + CurCommand->runCommand(*this, Arguments); } catch (int RetVal) { // The quit command exits the command loop by throwing an integer return @@ -273,7 +273,7 @@ int CLIDebugger::run() { std::cout << "ERROR: Debugger caught unexpected exception!\n"; // Attempt to continue. } - + // Write the prompt to get the next bit of user input std::cout << Prompt; } @@ -302,7 +302,7 @@ bool CLIDebugger::askYesNo(const std::string &Message) const { std::cout << "Please answer y or n.\n" << Message << " (y or n) " << std::flush; } - + // Ran out of input? return false; } diff --git a/tools/llvm-db/CLIDebugger.h b/tools/llvm-db/CLIDebugger.h index e2dbaaff7c..0f16c4fff8 100644 --- a/tools/llvm-db/CLIDebugger.h +++ b/tools/llvm-db/CLIDebugger.h @@ -1,10 +1,10 @@ //===- CLIDebugger.h - LLVM Command Line Interface Debugger -----*- C++ -*-===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines the CLIDebugger class, which implements a command line @@ -62,11 +62,11 @@ namespace llvm { // std::string Prompt; // set prompt, show prompt unsigned ListSize; // set listsize, show listsize - + //===------------------------------------------------------------------===// // Data to support user interaction // - + /// CurrentFile - The current source file we are inspecting, or null if /// none. const SourceFile *CurrentFile; diff --git a/tools/llvm-db/Commands.cpp b/tools/llvm-db/Commands.cpp index 37f8a78209..1716e1ba49 100644 --- a/tools/llvm-db/Commands.cpp +++ b/tools/llvm-db/Commands.cpp @@ -1,12 +1,12 @@ //===-- Commands.cpp - Implement various commands for the CLI -------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// -// +// // This file implements many builtin user commands. // //===----------------------------------------------------------------------===// @@ -91,7 +91,7 @@ bool CLIDebugger::printSourceLine(unsigned LineNo) { std::cout << " ->"; } - std::cout << "\t" << std::string(LineStart, LineEnd) << "\n"; + std::cout << "\t" << std::string(LineStart, LineEnd) << "\n"; return false; } @@ -115,9 +115,9 @@ void CLIDebugger::printProgramLocation(bool PrintLocation) { std::cout << getProgramInfo().getFunction(FuncDesc).getSymbolicName(); else std::cout << "<unknown function>"; - + CurrentFile = &FileDesc->getSourceText(); - + std::cout << " at " << CurrentFile->getFilename() << ":" << LineNo; if (ColNo) std::cout << ":" << ColNo; std::cout << "\n"; @@ -167,7 +167,7 @@ static unsigned getUnsignedIntegerOption(const char *Msg, std::string &Val, std::string Tok = getToken(Val); if (Tok.empty() || (isOnlyOption && !getToken(Val).empty())) throw std::string(Msg) + " expects an unsigned integer argument."; - + char *EndPtr; unsigned Result = strtoul(Tok.c_str(), &EndPtr, 0); if (EndPtr != Tok.c_str()+Tok.size()) @@ -179,7 +179,7 @@ static unsigned getUnsignedIntegerOption(const char *Msg, std::string &Val, /// getOptionalUnsignedIntegerOption - This method is just like /// getUnsignedIntegerOption, but if the argument value is not specified, a /// default is returned instead of causing an error. -static unsigned +static unsigned getOptionalUnsignedIntegerOption(const char *Msg, unsigned Default, std::string &Val, bool isOnlyOption = true) { // Check to see if the value was specified... @@ -201,13 +201,13 @@ void CLIDebugger::parseProgramOptions(std::string &Options) { // FIXME: tokenizing by whitespace is clearly incorrect. Instead we should // honor quotes and other things that a shell would. Also in the future we // should support redirection of standard IO. - + std::vector<std::string> Arguments; for (std::string A = getToken(Options); !A.empty(); A = getToken(Options)) Arguments.push_back(A); Dbg.setProgramArguments(Arguments.begin(), Arguments.end()); } - + //===----------------------------------------------------------------------===// // Program startup and shutdown options @@ -477,7 +477,7 @@ void CLIDebugger::breakCommand(std::string &Options) { // Figure out where the user wants a breakpoint. const SourceFile *File; unsigned LineNo; - + // Check to see if the user specified a line specifier. std::string Option = getToken(Options); // strip whitespace if (!Option.empty()) { @@ -489,13 +489,13 @@ void CLIDebugger::breakCommand(std::string &Options) { // Build a line specifier for the current stack frame. throw "FIXME: breaking at the current location is not implemented yet!"; } - + if (!File) File = CurrentFile; if (File == 0) throw "Unknown file to place breakpoint!"; std::cerr << "Break: " << File->getFilename() << ":" << LineNo << "\n"; - + throw "breakpoints not implemented yet!"; } @@ -542,7 +542,7 @@ void CLIDebugger::infoCommand(std::string &Options) { << SF.getLanguage().getSourceLanguageName() << "\n"; } else if (What == "sources") { - const std::map<const GlobalVariable*, SourceFileInfo*> &SourceFiles = + const std::map<const GlobalVariable*, SourceFileInfo*> &SourceFiles = getProgramInfo().getSourceFiles(); std::cout << "Source files for the program:\n"; for (std::map<const GlobalVariable*, SourceFileInfo*>::const_iterator I = @@ -607,7 +607,7 @@ void CLIDebugger::parseLineSpec(std::string &LineSpec, std::string Name = getToken(FirstPart); if (!getToken(FirstPart).empty()) throw "Extra junk in line specifier after '" + Name + "'."; - SourceFunctionInfo *SFI = + SourceFunctionInfo *SFI = getCurrentLanguage().lookupFunction(Name, getProgramInfo(), TheRuntimeInfo); if (SFI == 0) @@ -651,7 +651,7 @@ void CLIDebugger::listCommand(std::string &Options) { // Handle "list foo," correctly, by returning " " as the second token Options += " "; - + std::string FirstLineSpec = getToken(Options, ","); std::string SecondLineSpec = getToken(Options, ","); if (!getToken(Options, ",").empty()) @@ -689,7 +689,7 @@ void CLIDebugger::listCommand(std::string &Options) { } } else { - // Parse two line specifiers... + // Parse two line specifiers... const SourceFile *StartFile, *EndFile; unsigned StartLineNo, EndLineNo; parseLineSpec(FirstLineSpec, StartFile, StartLineNo); diff --git a/tools/llvm-db/llvm-db.cpp b/tools/llvm-db/llvm-db.cpp index f7913dfe47..140b8e40b6 100644 --- a/tools/llvm-db/llvm-db.cpp +++ b/tools/llvm-db/llvm-db.cpp @@ -1,10 +1,10 @@ //===- llvm-db.cpp - LLVM Debugger ----------------------------------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This utility implements a simple text-mode front-end to the LLVM debugger @@ -35,7 +35,7 @@ namespace { cl::desc("Add directory to the search for source files")); cl::alias SDA("d", cl::desc("Alias for --directory"), cl::aliasopt(SourceDirectories)); - + cl::opt<std::string> WorkingDirectory("cd", cl::desc("Use directory as current working directory"), cl::value_desc("directory")); @@ -73,7 +73,7 @@ int main(int argc, char **argv, char * const *envp) { Dbg.setWorkingDirectory(WorkingDirectory); for (unsigned i = 0, e = SourceDirectories.size(); i != e; ++i) D.addSourceDirectory(SourceDirectories[i]); - + if (!InputArgs.empty()) { try { D.fileCommand(InputArgs[0]); |