36 if (module && ofile) {
42 "warning: failed to get the uuid for object file: '");
49 if (dsym_uuid == module->
GetUUID())
55 "warning: UUID mismatch detected between modules:\n ");
60 dsym_uuid.
Dump(*feedback_strm);
79 return "Symbol vendor for MacOSX that looks for dSYM files that match "
95 llvm::dyn_cast_or_null<ObjectFileMachO>(module_sp->GetObjectFile());
100 Timer scoped_timer(func_cat,
101 "SymbolVendorMacOSX::CreateInstance (module = %s)",
102 module_sp->GetFileSpec().GetPath().c_str());
110 "SymbolVendorMacOSX::CreateInstance() locate dSYM");
113 "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
114 module_sp->GetFileSpec().GetPath().c_str());
118 FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());
126 if (!dsym_fspec && module_sp->GetObjectFile()->CalculateType() !=
132 file_spec = module_sp->GetFileSpec();
134 ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
135 module_spec.
GetUUID() = module_sp->GetUUID();
140 module_sp->GetSourceMappingList().Append(
146 std::string dsym_root = dsym_fspec.
GetPath();
147 const size_t pos = dsym_root.find(
"/Contents/Resources/");
148 dsym_root = pos != std::string::npos ? dsym_root.substr(0, pos) :
"";
155 dsym_file_data_sp, dsym_file_data_offset);
159 if (dsym_objfile_sp && !module_sp->GetSymbolFileFileSpec()) {
160 module_sp->SetSymbolFileFileSpec(dsym_fspec);
162 if (
UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm)) {
165 if (module_sp->GetSourceMappingList().IsEmpty()) {
169 if (!uuid_str.empty() && !dsym_root.empty()) {
170 char dsym_uuid_plist_path[
PATH_MAX];
171 snprintf(dsym_uuid_plist_path,
sizeof(dsym_uuid_plist_path),
172 "%s/Contents/Resources/%s.plist", dsym_root.c_str(),
174 FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path);
178 std::string DBGBuildSourcePath;
179 std::string DBGSourcePath;
187 if (plist_sp.get() && plist_sp->GetAsDictionary() &&
188 plist_sp->GetAsDictionary()->HasKey(
189 "DBGSourcePathRemapping") &&
190 plist_sp->GetAsDictionary()
191 ->GetValueForKey(
"DBGSourcePathRemapping")
192 ->GetAsDictionary()) {
204 bool new_style_source_remapping_dictionary =
false;
205 bool do_truncate_remapping_names =
false;
206 std::string original_DBGSourcePath_value = DBGSourcePath;
207 if (plist_sp->GetAsDictionary()->HasKey(
"DBGVersion")) {
208 std::string version_string =
209 std::string(plist_sp->GetAsDictionary()
210 ->GetValueForKey(
"DBGVersion")
211 ->GetStringValue(
""));
212 if (!version_string.empty() &&
213 isdigit(version_string[0])) {
214 int version_number = atoi(version_string.c_str());
215 if (version_number > 1) {
216 new_style_source_remapping_dictionary =
true;
218 if (version_number == 2) {
219 do_truncate_remapping_names =
true;
229 [&module_sp, new_style_source_remapping_dictionary,
230 original_DBGSourcePath_value,
231 do_truncate_remapping_names](
238 std::string DBGSourcePath =
239 std::string(object->GetStringValue());
240 if (!new_style_source_remapping_dictionary &&
241 !original_DBGSourcePath_value.empty()) {
242 DBGSourcePath = original_DBGSourcePath_value;
244 module_sp->GetSourceMappingList().Append(
245 key, DBGSourcePath,
true);
252 if (do_truncate_remapping_names) {
254 FileSpec source_path(DBGSourcePath.c_str());
259 module_sp->GetSourceMappingList().Append(
274 if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
275 module_sp->GetSourceMappingList().Append(
276 DBGBuildSourcePath, DBGSourcePath,
true);
286 return symbol_vendor;
295 return symbol_vendor;
#define LLDB_PLUGIN_DEFINE(PluginName)
static bool UUIDsMatch(Module *module, ObjectFile *ofile, lldb_private::Stream *feedback_strm)
static lldb_private::SymbolVendor * CreateInstance(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm)
static llvm::StringRef GetPluginDescriptionStatic()
static llvm::StringRef GetPluginNameStatic()
bool GetValueAsString(const char *key, std::string &value) const
StructuredData::ObjectSP GetStructuredData()
bool RemoveLastPathComponent()
Removes the last path component by replacing the current path with its parent.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Dump(llvm::raw_ostream &s) const
Dump this object to a Stream.
static FileSystem & Instance()
PathMappingList & GetSourceMappingList() const
A class that describes an executable image and its associated object and symbol files.
const lldb_private::UUID & GetUUID()
Get a reference to the UUID value contained in this object.
const FileSpec & GetFileSpec() const
Get const accessor for the module file specification.
A plug-in interface definition class for object file parsers.
static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file_spec, lldb::offset_t file_offset, lldb::offset_t file_size, lldb::DataBufferSP &data_sp, lldb::offset_t &data_offset)
Find a ObjectFile plug-in that can parse file_spec.
@ eTypeObjectFile
An intermediate object file.
virtual FileSpec & GetFileSpec()
Get accessor to the object file specification.
virtual UUID GetUUID()=0
Gets the UUID for this object file.
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
ObjectSP GetValueForKey(llvm::StringRef key) const
void ForEach(std::function< bool(llvm::StringRef key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
std::shared_ptr< Object > ObjectSP
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp)
static FileSpecList GetDefaultDebugFileSearchPaths()
A timer class that simplifies common timing metrics.
void Dump(Stream &s) const
std::string GetAsString(llvm::StringRef separator="-") const
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP