summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorTamas Berghammer <tberghammer@google.com>2015-06-18 20:43:56 +0000
committerTamas Berghammer <tberghammer@google.com>2015-06-18 20:43:56 +0000
commit783bfc8caa4c50c0248f90ea7adf2dbd1e48f4e7 (patch)
tree694f259f810cd5047c9525287ec609d39d78fede /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parentd2158755eb718da05fc0ba817b9b7fb64d74a54f (diff)
downloadbcm5719-llvm-783bfc8caa4c50c0248f90ea7adf2dbd1e48f4e7.tar.gz
bcm5719-llvm-783bfc8caa4c50c0248f90ea7adf2dbd1e48f4e7.zip
Fetch object file load address if it isn't specified by the linker
Differential revision: http://reviews.llvm.org/D10490 llvm-svn: 240052
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 355f052b786..64972dfda36 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -4121,6 +4121,47 @@ ProcessGDBRemote::LoadModules ()
return new_modules.GetSize();
}
+Error
+ProcessGDBRemote::GetFileLoadAddress(const FileSpec& file, bool& is_loaded, lldb::addr_t& load_addr)
+{
+ is_loaded = false;
+ load_addr = LLDB_INVALID_ADDRESS;
+
+ std::string file_path = file.GetPath(false);
+ if (file_path.empty ())
+ return Error("Empty file name specified");
+
+ StreamString packet;
+ packet.PutCString("qFileLoadAddress:");
+ packet.PutCStringAsRawHex8(file_path.c_str());
+
+ StringExtractorGDBRemote response;
+ if (m_gdb_comm.SendPacketAndWaitForResponse(packet.GetString().c_str(), response, false) != GDBRemoteCommunication::PacketResult::Success)
+ return Error("Sending qFileLoadAddress packet failed");
+
+ if (response.IsErrorResponse())
+ {
+ if (response.GetError() == 1)
+ {
+ // The file is not loaded into the inferior
+ is_loaded = false;
+ load_addr = LLDB_INVALID_ADDRESS;
+ return Error();
+ }
+
+ return Error("Fetching file load address from remote server returned an error");
+ }
+
+ if (response.IsNormalResponse())
+ {
+ is_loaded = true;
+ load_addr = response.GetHexMaxU64(false, LLDB_INVALID_ADDRESS);
+ return Error();
+ }
+
+ return Error("Unknown error happened during sending the load address packet");
+}
+
class CommandObjectProcessGDBRemoteSpeedTest: public CommandObjectParsed
{
public:
OpenPOWER on IntegriCloud