summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-09-19 02:33:57 +0000
committerGreg Clayton <gclayton@apple.com>2010-09-19 02:33:57 +0000
commit1b65488229479ffced81cab3d36b59d6bff46fcd (patch)
treebf504814b8e547c5cef083b13ed3efb6ca5060ff /lldb/source/Target/Process.cpp
parentdd4da82c923e6f71c85e3579b758c775ec02c2aa (diff)
downloadbcm5719-llvm-1b65488229479ffced81cab3d36b59d6bff46fcd.tar.gz
bcm5719-llvm-1b65488229479ffced81cab3d36b59d6bff46fcd.zip
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
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp41
1 files changed, 11 insertions, 30 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index a9f6d55fd79..9a5452be053 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1826,14 +1826,14 @@ Process::GetArchSpecForExistingProcess (const char *process_name)
lldb::UserSettingsControllerSP
Process::GetSettingsController (bool finish)
{
- static UserSettingsControllerSP g_settings_controller (new ProcessSettingsController);
+ static UserSettingsControllerSP g_settings_controller (new SettingsController);
static bool initialized = false;
if (!initialized)
{
initialized = UserSettingsController::InitializeSettingsController (g_settings_controller,
- Process::ProcessSettingsController::global_settings_table,
- Process::ProcessSettingsController::instance_settings_table);
+ Process::SettingsController::global_settings_table,
+ Process::SettingsController::instance_settings_table);
}
if (finish)
@@ -1847,22 +1847,22 @@ Process::GetSettingsController (bool finish)
}
//--------------------------------------------------------------
-// class Process::ProcessSettingsController
+// class Process::SettingsController
//--------------------------------------------------------------
-Process::ProcessSettingsController::ProcessSettingsController () :
+Process::SettingsController::SettingsController () :
UserSettingsController ("process", Debugger::GetSettingsController())
{
m_default_settings.reset (new ProcessInstanceSettings (*this, false,
InstanceSettings::GetDefaultName().AsCString()));
}
-Process::ProcessSettingsController::~ProcessSettingsController ()
+Process::SettingsController::~SettingsController ()
{
}
lldb::InstanceSettingsSP
-Process::ProcessSettingsController::CreateNewInstanceSettings (const char *instance_name)
+Process::SettingsController::CreateInstanceSettings (const char *instance_name)
{
ProcessInstanceSettings *new_settings = new ProcessInstanceSettings (*(Process::GetSettingsController().get()),
false, instance_name);
@@ -1989,18 +1989,6 @@ ProcessInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &n
}
void
-Process::ProcessSettingsController::UpdateGlobalVariable (const ConstString &var_name,
- const char *index_value,
- const char *value,
- const SettingEntry &entry,
- lldb::VarSetOperationType op,
- Error&err)
-{
- // Currently 'process' does not have any global settings.
-}
-
-
-void
ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
const ConstString &var_name,
StringList &value)
@@ -2053,13 +2041,6 @@ ProcessInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
value.AppendString ("unrecognized variable name");
}
-void
-Process::ProcessSettingsController::GetGlobalSettingsValue (const ConstString &var_name,
- StringList &value)
-{
- // Currently 'process' does not have any global settings.
-}
-
const ConstString
ProcessInstanceSettings::CreateInstanceName ()
{
@@ -2132,11 +2113,11 @@ ProcessInstanceSettings::DisableASLRVarName ()
//--------------------------------------------------
-// ProcessSettingsController Variable Tables
+// SettingsController Variable Tables
//--------------------------------------------------
SettingEntry
-Process::ProcessSettingsController::global_settings_table[] =
+Process::SettingsController::global_settings_table[] =
{
//{ "var-name", var-type , "default", enum-table, init'd, hidden, "help-text"},
{ NULL, eSetVarTypeNone, NULL, NULL, 0, 0, NULL }
@@ -2144,7 +2125,7 @@ Process::ProcessSettingsController::global_settings_table[] =
lldb::OptionEnumValueElement
-Process::ProcessSettingsController::g_plugins[] =
+Process::SettingsController::g_plugins[] =
{
{ eMacosx, "process.macosx", "Use the native MacOSX debugger plugin" },
{ eRemoteDebugger, "process.gdb-remote" , "Use the GDB Remote protocol based debugger plugin" },
@@ -2152,7 +2133,7 @@ Process::ProcessSettingsController::g_plugins[] =
};
SettingEntry
-Process::ProcessSettingsController::instance_settings_table[] =
+Process::SettingsController::instance_settings_table[] =
{
//{ "var-name", var-type, "default", enum-table, init'd, hidden, "help-text"},
{ "run-args", eSetVarTypeArray, NULL, NULL, false, false, "A list containing all the arguments to be passed to the executable when it is run." },
OpenPOWER on IntegriCloud