[Lldb-commits] [PATCH] Add qModuleInfo request in order to get module information (uuid, triple, ..) by module path from remote platform.
clayborg at gmail.com
Thu Feb 19 11:48:50 PST 2015
We need to deal with files that contains more than 1 architecture slice and either pick the right one and return it, or return multiple matches. See inlined comments.
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:1123
@@ +1122,3 @@
+ const ModuleSpec module_spec(FileSpec(module_path.c_str(), true));
+ const ModuleSP module(new Module(module_spec));
The module_path can represent a fat file with multiple architectures (or it could be a .a file with many many .o files inside of it).
You actually want to use:
FileSpec module_spec(module_path.c_str(), true);
if (ObjectFile::GetModuleSpecifications(module_spec, 0, 0, module_specs))
and you probably want to return all values that it comes up with. (triple + UUID for each slice). If you want to limit it down, you will need to match the architecture against the current process' architecture and return just that one. This is of course only if "module_specs" has more than 1 module specs inside it.
If you choose to return multiple items, you will need to convert your answer over to using JSON like some of the packets Jason Molenda has added to debugserver. If you limit it down to 1 item, then you can just figure out which one you want from the list if there is more than one and just return that.
Comment at: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:1128-1131
@@ +1127,6 @@
+ const auto uuid_str = module->GetUUID().GetAsString();
+ response.PutCString ("uuid:");
> Maybe return an error code if there is no UUID in the module? Or add timestamp or timestamp+date as UUID?
Check uuid_str to see if it is empty and if not, do the above "uuid:" code, else maybe get the MD5 checksum and return a "md5:XXXXXXXXX" value instead?
More information about the lldb-commits