summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
authorHafiz Abid Qadeer <hafiz_abid@mentor.com>2017-01-24 23:07:27 +0000
committerHafiz Abid Qadeer <hafiz_abid@mentor.com>2017-01-24 23:07:27 +0000
commitb10fb96541bc45aea71c8652bb1786899826f7ad (patch)
treee8e96808bc8afa6246afa5d880daf41ec14534bc /lldb/source/Commands/CommandObjectTarget.cpp
parent8c6ed0f3a081fee5f6e1372c39dbbcec07969ab9 (diff)
downloadbcm5719-llvm-b10fb96541bc45aea71c8652bb1786899826f7ad.tar.gz
bcm5719-llvm-b10fb96541bc45aea71c8652bb1786899826f7ad.zip
Provide option to set pc of the file loaded in memory.
Summary: This commit adds an option to set PC to the entry point of the file loaded using "target module load" command. In D28804, Greg asked me to separate this part under a different option. Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D28944 llvm-svn: 292989
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 61e9e9bcd94..37dec184805 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -2568,8 +2568,11 @@ public:
m_file_option(LLDB_OPT_SET_1, false, "file", 'f', 0, eArgTypeName,
"Fullpath or basename for module to load.", ""),
m_load_option(LLDB_OPT_SET_1, false, "load", 'l',
- "Write file contents to the memory.",
- false, true),
+ "Write file contents to the memory.", false, true),
+ m_pc_option(LLDB_OPT_SET_1, false, "--set-pc-to-entry", 'p',
+ "Set PC to the entry point."
+ " Only applicable with '--load' option.",
+ false, true),
m_slide_option(LLDB_OPT_SET_1, false, "slide", 's', 0, eArgTypeOffset,
"Set the load address for all sections to be the "
"virtual address in the file plus the offset.",
@@ -2578,6 +2581,7 @@ public:
LLDB_OPT_SET_1);
m_option_group.Append(&m_file_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append(&m_load_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Append(&m_pc_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append(&m_slide_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Finalize();
}
@@ -2590,6 +2594,7 @@ protected:
bool DoExecute(Args &args, CommandReturnObject &result) override {
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
const bool load = m_load_option.GetOptionValue().GetCurrentValue();
+ const bool set_pc = m_pc_option.GetOptionValue().GetCurrentValue();
if (target == nullptr) {
result.AppendError("invalid target, create a debug target using the "
"'target create' command");
@@ -2742,7 +2747,7 @@ protected:
process->Flush();
}
if (load) {
- Error error = module->LoadInMemory(*target);
+ Error error = module->LoadInMemory(*target, set_pc);
if (error.Fail()) {
result.AppendError(error.AsCString());
return false;
@@ -2811,6 +2816,7 @@ protected:
OptionGroupUUID m_uuid_option_group;
OptionGroupString m_file_option;
OptionGroupBoolean m_load_option;
+ OptionGroupBoolean m_pc_option;
OptionGroupUInt64 m_slide_option;
};
OpenPOWER on IntegriCloud