hanchenye-llvm-project/lldb/source/Core
Greg Clayton 1b65488229 Added code that will allow completely customizable prompts for use in
replacing the "(lldb)" prompt, the "frame #1..." displays when doing
stack backtracing and the "thread #1....". This will allow you to see 
exactly the information that you want to see where you want to see it.
This currently isn't hookup up to the prompts yet, but it will be soon.

So what is the format of the prompts? Prompts can contain variables that
have access to the current program state. Variables are text that appears
in between a prefix of "${" and ends with a "}". Some of the interesting
variables include:

// The frame index (0, 1, 2, 3...)
${frame.index}

// common frame registers with generic names
${frame.pc}
${frame.sp}
${frame.fp}
${frame.ra}
${frame.flags}

// Access to any frame registers by name where REGNAME is any register name:
${frame.reg.REGNAME}

// The current compile unit file where the frame is located
${file.basename}
${file.fullpath}

// Function information
${function.name}
${function.pc-offset}

// Process info
${process.file.basename}
${process.file.fullpath}
${process.id}
${process.name}

// Thread info
${thread.id}
${thread.index}
${thread.name}
${thread.queue}
${thread.stop-reason}

// Target information
${target.arch}

// The current module for the current frame (the shared library or executable
// that contains the current frame PC value):
${module.file.basename}
${module.file.fullpath}

// Access to the line entry for where the current frame is when your thread
// is stopped:
${line.file.basename}
${line.file.fullpath}
${line.number}
${line.start-addr}
${line.end-addr}

Many times the information that you might have in your prompt might not be
available and you won't want it to print out if it isn't valid. To take care
of this you can enclose everything that must resolve into a scope. A scope
is starts with '{' and ends with '}'. For example in order to only display
the current file and line number when the information is available the format
would be:

"{ at {$line.file.basename}:${line.number}}"

Broken down this is:

start the scope: "{"

format whose content will only be displayed if all information is available:
        "at {$line.file.basename}:${line.number}"

end the scope: "}"

We currently can represent the infomration we see when stopped at a frame:

frame #0: 0x0000000100000e85 a.out`main + 4 at test.c:19

with the following format:

"frame #${frame.index}: ${frame.pc} {${module.file.basename}`}{${function.name}{${function.pc-offset}}{ at ${line.file.basename}:${line.number}}\n"

This breaks down to always print:

        "frame #${frame.index}: ${frame.pc} "

only print the module followed by a tick if we have a valid module:

        "{${module.file.basename}`}"
        
print the function name with optional offset:
        "{${function.name}{${function.pc-offset}}"

print the line info if it is available:
        
        "{ at ${line.file.basename}:${line.number}}"

then finish off with a newline:

        "\n"

Notice you can also put newlines ("\n") and tabs and everything else you
are used to putting in a format string when desensitized with the \ character.

Cleaned up some of the user settings controller subclasses. All of them 
do not have any global settings variables and were all implementing stubs
for the get/set global settings variable. Now there is a default version
in UserSettingsController that will do nothing.

llvm-svn: 114306
2010-09-19 02:33:57 +00:00
..
Address.cpp Moved the section load list up into the target so we can use the target 2010-09-14 23:36:40 +00:00
AddressRange.cpp Moved the section load list up into the target so we can use the target 2010-09-14 23:36:40 +00:00
AddressResolver.cpp
AddressResolverFileLine.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
AddressResolverName.cpp Added function name types to allow us to set breakpoints by name more 2010-06-28 21:30:43 +00:00
ArchSpec.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Baton.cpp
Broadcaster.cpp
Communication.cpp Fixed a race condition that was sometimes stopping our command line 2010-09-15 05:19:45 +00:00
Connection.cpp
ConnectionFileDescriptor.cpp Warnings cleanup patch from Jean-Daniel Dupas. 2010-07-23 15:37:46 +00:00
ConstString.cpp Improved name demangling performance by 20% on darwin. 2010-09-03 23:26:12 +00:00
DataBufferHeap.cpp
DataBufferMemoryMap.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
DataExtractor.cpp General command line help cleanup: 2010-09-18 03:37:20 +00:00
Debugger.cpp Added code that will allow completely customizable prompts for use in 2010-09-19 02:33:57 +00:00
Disassembler.cpp Fixed a missing newline when dumping mixed disassembly. 2010-09-15 05:51:24 +00:00
DynamicLoader.cpp General command line help cleanup: 2010-09-18 03:37:20 +00:00
Error.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Event.cpp Remove use of STL collection class use of the "data()" method since it isn't 2010-07-20 22:52:08 +00:00
FileSpec.cpp Add the ability to not resolve the name passed to FileSpec. Then don't resolve the names of compilation units found in DWARF. 2010-09-16 00:57:33 +00:00
FileSpecList.cpp
Flags.cpp
InputReader.cpp I enabled some extra warnings for hidden local variables and for hidden 2010-07-14 00:18:15 +00:00
Language.cpp Created lldb::LanguageType by moving an enumeration from the 2010-07-28 02:04:09 +00:00
Listener.cpp
Log.cpp Fixed the log streams for logs that output to 2010-06-23 21:28:25 +00:00
Makefile Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Mangled.cpp The Mangled name comparision should prefer the mangled name. 2010-09-15 00:13:44 +00:00
Module.cpp Remove the eSymbolTypeFunction, eSymbolTypeGlobal, and eSymbolTypeStatic. 2010-09-11 03:13:28 +00:00
ModuleChild.cpp
ModuleList.cpp Got a lot of the kinks worked out in the inline support after debugging more 2010-08-24 21:05:24 +00:00
PluginManager.cpp The first part of an lldb native stack unwinder. 2010-09-10 07:49:16 +00:00
RegularExpression.cpp Remove use of STL collection class use of the "data()" method since it isn't 2010-07-20 22:52:08 +00:00
Scalar.cpp Move Args.{cpp,h} and Options.{cpp,h} to Interpreter where they really belong. 2010-06-15 19:49:27 +00:00
SearchFilter.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
Section.cpp Moved the section load list up into the target so we can use the target 2010-09-14 23:36:40 +00:00
SourceManager.cpp
State.cpp
Stream.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
StreamFile.cpp We now have SBStream that mirrors the generic stream classes we 2010-09-17 17:42:16 +00:00
StreamString.cpp
StringList.cpp Merged Eli Friedman's linux build changes where he added Makefile files that 2010-07-09 20:39:50 +00:00
TTYState.cpp
Timer.cpp Added some missing API for address resolving within a module, and looking 2010-09-10 18:31:35 +00:00
UUID.cpp Remove unused uuid_t constructor for lldb_private::UUID. 2010-06-10 03:08:05 +00:00
UserID.cpp Move trivial parts of UserID into the header. 2010-06-22 10:44:12 +00:00
UserSettingsController.cpp Added code that will allow completely customizable prompts for use in 2010-09-19 02:33:57 +00:00
VMRange.cpp Added support for inlined stack frames being represented as real stack frames 2010-08-24 00:45:41 +00:00
Value.cpp Moved the section load list up into the target so we can use the target 2010-09-14 23:36:40 +00:00
ValueObject.cpp General command line help cleanup: 2010-09-18 03:37:20 +00:00
ValueObjectChild.cpp Change over to using the definitions for mach-o types and defines to the 2010-07-21 22:12:05 +00:00
ValueObjectList.cpp StackFrame objects now own ValueObjects for any frame variables (locals, args, 2010-09-02 02:59:18 +00:00
ValueObjectRegister.cpp Change over to using the definitions for mach-o types and defines to the 2010-07-21 22:12:05 +00:00
ValueObjectVariable.cpp Fixed an issue with: 2010-09-18 04:00:06 +00:00