37 if (module && ofile) {
43 "warning: failed to get the uuid for object file: '");
50 if (dsym_uuid == module->
GetUUID())
56 "warning: UUID mismatch detected between modules:\n ");
61 dsym_uuid.
Dump(feedback_strm);
80 return "Symbol vendor for MacOSX that looks for dSYM files that match "
96 llvm::dyn_cast_or_null<ObjectFileMachO>(module_sp->GetObjectFile());
101 Timer scoped_timer(func_cat,
102 "SymbolVendorMacOSX::CreateInstance (module = %s)",
103 module_sp->GetFileSpec().GetPath().c_str());
111 "SymbolVendorMacOSX::CreateInstance() locate dSYM");
114 "SymbolVendorMacOSX::CreateInstance (module = %s) locate dSYM",
115 module_sp->GetFileSpec().GetPath().c_str());
119 FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec());
121 ObjectFileSP dsym_objfile_sp;
127 file_spec = module_sp->GetFileSpec();
129 ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
130 module_spec.
GetUUID() = module_sp->GetUUID();
135 module_sp->GetSourceMappingList().Append(
141 std::string dsym_root = dsym_fspec.
GetPath();
142 const size_t pos = dsym_root.find(
"/Contents/Resources/");
143 dsym_root = pos != std::string::npos ? dsym_root.substr(0, pos) :
"";
145 DataBufferSP dsym_file_data_sp;
150 dsym_file_data_sp, dsym_file_data_offset);
154 if (dsym_objfile_sp && !module_sp->GetSymbolFileFileSpec()) {
155 module_sp->SetSymbolFileFileSpec(dsym_fspec);
157 if (
UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm)) {
160 if (module_sp->GetSourceMappingList().IsEmpty()) {
164 if (!uuid_str.empty() && !dsym_root.empty()) {
165 char dsym_uuid_plist_path[
PATH_MAX];
166 snprintf(dsym_uuid_plist_path,
sizeof(dsym_uuid_plist_path),
167 "%s/Contents/Resources/%s.plist", dsym_root.c_str(),
169 FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path);
173 std::string DBGBuildSourcePath;
174 std::string DBGSourcePath;
182 if (plist_sp.get() && plist_sp->GetAsDictionary() &&
183 plist_sp->GetAsDictionary()->HasKey(
184 "DBGSourcePathRemapping") &&
185 plist_sp->GetAsDictionary()
186 ->GetValueForKey(
"DBGSourcePathRemapping")
187 ->GetAsDictionary()) {
199 bool new_style_source_remapping_dictionary =
false;
200 bool do_truncate_remapping_names =
false;
201 std::string original_DBGSourcePath_value = DBGSourcePath;
202 if (plist_sp->GetAsDictionary()->HasKey(
"DBGVersion")) {
203 std::string version_string =
204 std::string(plist_sp->GetAsDictionary()
205 ->GetValueForKey(
"DBGVersion")
206 ->GetStringValue(
""));
207 if (!version_string.empty() &&
208 isdigit(version_string[0])) {
209 int version_number = atoi(version_string.c_str());
210 if (version_number > 1) {
211 new_style_source_remapping_dictionary =
true;
213 if (version_number == 2) {
214 do_truncate_remapping_names =
true;
224 [&module_sp, new_style_source_remapping_dictionary,
225 original_DBGSourcePath_value,
226 do_truncate_remapping_names](
233 std::string DBGSourcePath =
234 std::string(object->GetStringValue());
235 if (!new_style_source_remapping_dictionary &&
236 !original_DBGSourcePath_value.empty()) {
237 DBGSourcePath = original_DBGSourcePath_value;
239 module_sp->GetSourceMappingList().Append(
247 if (do_truncate_remapping_names) {
249 FileSpec source_path(DBGSourcePath.c_str());
254 module_sp->GetSourceMappingList().Append(
269 if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
270 module_sp->GetSourceMappingList().Append(
271 DBGBuildSourcePath, DBGSourcePath,
true);
281 return symbol_vendor;
290 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()
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
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.
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 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(ConstString key, Object *object)> const &callback) const
Dictionary * GetAsDictionary()
std::shared_ptr< Object > ObjectSP
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp)
static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths)
static FileSpecList GetDefaultDebugFileSearchPaths()
A timer class that simplifies common timing metrics.
std::string GetAsString(llvm::StringRef separator="-") const
void Dump(Stream *s) const
A class that represents a running process on the host machine.