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 file_spec = module_sp->GetFileSpec();
128 ModuleSpec module_spec(file_spec, module_sp->GetArchitecture());
129 module_spec.
GetUUID() = module_sp->GetUUID();
134 module_sp->GetSourceMappingList().Append(
140 std::string dsym_root = dsym_fspec.
GetPath();
141 const size_t pos = dsym_root.find(
"/Contents/Resources/");
142 dsym_root = pos != std::string::npos ? dsym_root.substr(0, pos) :
"";
149 dsym_file_data_sp, dsym_file_data_offset);
153 if (dsym_objfile_sp && !module_sp->GetSymbolFileFileSpec()) {
154 module_sp->SetSymbolFileFileSpec(dsym_fspec);
156 if (
UUIDsMatch(module_sp.get(), dsym_objfile_sp.get(), feedback_strm)) {
159 if (module_sp->GetSourceMappingList().IsEmpty()) {
163 if (!uuid_str.empty() && !dsym_root.empty()) {
164 char dsym_uuid_plist_path[
PATH_MAX];
165 snprintf(dsym_uuid_plist_path,
sizeof(dsym_uuid_plist_path),
166 "%s/Contents/Resources/%s.plist", dsym_root.c_str(),
168 FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path);
172 std::string DBGBuildSourcePath;
173 std::string DBGSourcePath;
181 if (plist_sp.get() && plist_sp->GetAsDictionary() &&
182 plist_sp->GetAsDictionary()->HasKey(
183 "DBGSourcePathRemapping") &&
184 plist_sp->GetAsDictionary()
185 ->GetValueForKey(
"DBGSourcePathRemapping")
186 ->GetAsDictionary()) {
198 bool new_style_source_remapping_dictionary =
false;
199 bool do_truncate_remapping_names =
false;
200 std::string original_DBGSourcePath_value = DBGSourcePath;
201 if (plist_sp->GetAsDictionary()->HasKey(
"DBGVersion")) {
202 std::string version_string =
203 std::string(plist_sp->GetAsDictionary()
204 ->GetValueForKey(
"DBGVersion")
205 ->GetStringValue(
""));
206 if (!version_string.empty() &&
207 isdigit(version_string[0])) {
208 int version_number = atoi(version_string.c_str());
209 if (version_number > 1) {
210 new_style_source_remapping_dictionary =
true;
212 if (version_number == 2) {
213 do_truncate_remapping_names =
true;
223 [&module_sp, new_style_source_remapping_dictionary,
224 original_DBGSourcePath_value,
225 do_truncate_remapping_names](
232 std::string DBGSourcePath =
233 std::string(object->GetStringValue());
234 if (!new_style_source_remapping_dictionary &&
235 !original_DBGSourcePath_value.empty()) {
236 DBGSourcePath = original_DBGSourcePath_value;
238 module_sp->GetSourceMappingList().Append(
239 key, DBGSourcePath,
true);
246 if (do_truncate_remapping_names) {
248 FileSpec source_path(DBGSourcePath.c_str());
253 module_sp->GetSourceMappingList().Append(
268 if (!DBGBuildSourcePath.empty() && !DBGSourcePath.empty()) {
269 module_sp->GetSourceMappingList().Append(
270 DBGBuildSourcePath, DBGSourcePath,
true);
280 return symbol_vendor;
289 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.
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