зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329111 - Rename SharedLibraryInfo::mName to mModuleName, and consistently cut off the path on all platforms. r=marco
MozReview-Commit-ID: 8gqqVjTjy1Z --HG-- extra : rebase_source : 646340086cd46fe023495bfca140e859c98a5205
This commit is contained in:
Родитель
83eba08a45
Коммит
0048861a6b
|
@ -1694,22 +1694,6 @@ public:
|
|||
for (unsigned int i = 0, n = mRawModules.GetSize(); i != n; i++) {
|
||||
const SharedLibrary &info = mRawModules.GetEntry(i);
|
||||
|
||||
nsString basename = info.GetName();
|
||||
#if defined(XP_MACOSX) || defined(XP_LINUX)
|
||||
int32_t pos = basename.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
basename.Cut(0, pos + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsString debug_basename = info.GetDebugName();
|
||||
#if defined(XP_MACOSX) || defined(XP_LINUX)
|
||||
pos = debug_basename.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
debug_basename.Cut(0, pos + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS::RootedObject moduleObj(cx, JS_NewPlainObject(cx));
|
||||
if (!moduleObj) {
|
||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||
|
@ -1717,7 +1701,7 @@ public:
|
|||
}
|
||||
|
||||
// Module name.
|
||||
JS::RootedString moduleName(cx, JS_NewUCStringCopyZ(cx, basename.get()));
|
||||
JS::RootedString moduleName(cx, JS_NewUCStringCopyZ(cx, info.GetModuleName().get()));
|
||||
if (!moduleName || !JS_DefineProperty(cx, moduleObj, "name", moduleName, JSPROP_ENUMERATE)) {
|
||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
|
@ -1726,8 +1710,8 @@ public:
|
|||
// Module debug name.
|
||||
JS::RootedValue moduleDebugName(cx);
|
||||
|
||||
if (!debug_basename.IsEmpty()) {
|
||||
JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, debug_basename.get()));
|
||||
if (!info.GetDebugName().IsEmpty()) {
|
||||
JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, info.GetDebugName().get()));
|
||||
if (!str_moduleDebugName) {
|
||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
|
@ -3228,18 +3212,8 @@ GetStackAndModules(const std::vector<uintptr_t>& aPCs)
|
|||
#ifdef MOZ_GECKO_PROFILER
|
||||
for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) {
|
||||
const SharedLibrary &info = rawModules.GetEntry(i);
|
||||
nsString basename = info.GetDebugName();
|
||||
#if defined(XP_MACOSX) || defined(XP_LINUX)
|
||||
// We want to use just the basename as the libname, but the
|
||||
// current profiler addon needs the full path name, so we compute the
|
||||
// basename in here.
|
||||
int32_t pos = basename.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
basename.Cut(0, pos + 1);
|
||||
}
|
||||
#endif
|
||||
mozilla::Telemetry::ProcessedStack::Module module = {
|
||||
basename,
|
||||
info.GetDebugName(),
|
||||
info.GetBreakpadId()
|
||||
};
|
||||
Ret.AddModule(module);
|
||||
|
|
|
@ -81,12 +81,17 @@ dl_iterate_callback(struct dl_phdr_info *dl_info, size_t size, void *data)
|
|||
if (end > libEnd)
|
||||
libEnd = end;
|
||||
}
|
||||
const char *name = dl_info->dlpi_name;
|
||||
const char *path = dl_info->dlpi_name;
|
||||
|
||||
nsAutoString nameStr;
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(path), nameStr)));
|
||||
|
||||
SharedLibrary shlib(libStart, libEnd, 0, getId(name), nameStr, nameStr, "");
|
||||
int32_t pos = nameStr.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
nameStr.Cut(0, pos + 1);
|
||||
}
|
||||
|
||||
SharedLibrary shlib(libStart, libEnd, 0, getId(path), nameStr, nameStr, "");
|
||||
info.AddSharedLibrary(shlib);
|
||||
|
||||
return 0;
|
||||
|
@ -126,10 +131,10 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
unsigned long end;
|
||||
char perm[6] = "";
|
||||
unsigned long offset;
|
||||
char name[PATH_MAX] = "";
|
||||
char modulePath[PATH_MAX] = "";
|
||||
ret = sscanf(line.c_str(),
|
||||
"%lx-%lx %6s %lx %*s %*x %" PATH_MAX_STRING(PATH_MAX) "s\n",
|
||||
&start, &end, perm, &offset, name);
|
||||
&start, &end, perm, &offset, modulePath);
|
||||
if (!strchr(perm, 'x')) {
|
||||
// Ignore non executable entries
|
||||
continue;
|
||||
|
@ -141,7 +146,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
#if defined(PROFILE_JAVA)
|
||||
// Use proc/pid/maps to get the dalvik-jit section since it has
|
||||
// no associated phdrs
|
||||
if (strcmp(name, "/dev/ashmem/dalvik-jit-code-cache") != 0) {
|
||||
if (strcmp(modulePath, "/dev/ashmem/dalvik-jit-code-cache") != 0) {
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
|
@ -154,7 +159,12 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
#endif
|
||||
|
||||
nsAutoString nameStr;
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(modulePath), nameStr)));
|
||||
|
||||
int32_t pos = nameStr.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
nameStr.Cut(0, pos + 1);
|
||||
}
|
||||
|
||||
SharedLibrary shlib(start, end, offset, getId(name), nameStr, nameStr, "");
|
||||
info.AddSharedLibrary(shlib);
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef segment_command_64 mach_segment_command_type;
|
|||
#endif
|
||||
|
||||
static
|
||||
void addSharedLibrary(const platform_mach_header* header, char *name, SharedLibraryInfo &info) {
|
||||
void addSharedLibrary(const platform_mach_header* header, char *path, SharedLibraryInfo &info) {
|
||||
const struct load_command *cmd =
|
||||
reinterpret_cast<const struct load_command *>(header + 1);
|
||||
|
||||
|
@ -73,7 +73,12 @@ void addSharedLibrary(const platform_mach_header* header, char *name, SharedLibr
|
|||
}
|
||||
|
||||
nsAutoString nameStr;
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(name), nameStr)));
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(NS_CopyNativeToUnicode(nsDependentCString(path), nameStr)));
|
||||
|
||||
int32_t pos = nameStr.RFindChar('/');
|
||||
if (pos != kNotFound) {
|
||||
nameStr.Cut(0, pos + 1);
|
||||
}
|
||||
|
||||
info.AddSharedLibrary(SharedLibrary(start, start + size, 0, uuid.str(),
|
||||
nameStr, nameStr, ""));
|
||||
|
|
|
@ -182,17 +182,17 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
|||
}
|
||||
}
|
||||
|
||||
nsAutoString moduleName(modulePath);
|
||||
int32_t pos = moduleName.RFindChar('\\');
|
||||
nsAutoString moduleNameStr(modulePath);
|
||||
int32_t pos = moduleNameStr.RFindChar('\\');
|
||||
if (pos != kNotFound) {
|
||||
moduleName.Cut(0, pos + 1);
|
||||
moduleNameStr.Cut(0, pos + 1);
|
||||
}
|
||||
|
||||
SharedLibrary shlib((uintptr_t)module.lpBaseOfDll,
|
||||
(uintptr_t)module.lpBaseOfDll + module.SizeOfImage,
|
||||
0, // DLLs are always mapped at offset 0 on Windows
|
||||
breakpadId,
|
||||
moduleName,
|
||||
moduleNameStr,
|
||||
pdbNameStr,
|
||||
GetVersion(modulePath));
|
||||
sharedLibraryInfo.AddSharedLibrary(shlib);
|
||||
|
|
|
@ -27,14 +27,14 @@ public:
|
|||
uintptr_t aEnd,
|
||||
uintptr_t aOffset,
|
||||
const std::string& aBreakpadId,
|
||||
const nsString& aName,
|
||||
const nsString& aModuleName,
|
||||
const nsString& aDebugName,
|
||||
const std::string& aVersion)
|
||||
: mStart(aStart)
|
||||
, mEnd(aEnd)
|
||||
, mOffset(aOffset)
|
||||
, mBreakpadId(aBreakpadId)
|
||||
, mName(aName)
|
||||
, mModuleName(aModuleName)
|
||||
, mDebugName(aDebugName)
|
||||
, mVersion(aVersion)
|
||||
{}
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
, mEnd(aEntry.mEnd)
|
||||
, mOffset(aEntry.mOffset)
|
||||
, mBreakpadId(aEntry.mBreakpadId)
|
||||
, mName(aEntry.mName)
|
||||
, mModuleName(aEntry.mModuleName)
|
||||
, mDebugName(aEntry.mDebugName)
|
||||
, mVersion(aEntry.mVersion)
|
||||
{}
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
mEnd = aEntry.mEnd;
|
||||
mOffset = aEntry.mOffset;
|
||||
mBreakpadId = aEntry.mBreakpadId;
|
||||
mName = aEntry.mName;
|
||||
mModuleName = aEntry.mModuleName;
|
||||
mDebugName = aEntry.mDebugName;
|
||||
mVersion = aEntry.mVersion;
|
||||
return *this;
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
return (mStart == other.mStart) &&
|
||||
(mEnd == other.mEnd) &&
|
||||
(mOffset == other.mOffset) &&
|
||||
(mName == other.mName) &&
|
||||
(mModuleName == other.mModuleName) &&
|
||||
(mDebugName == other.mDebugName) &&
|
||||
(mBreakpadId == other.mBreakpadId) &&
|
||||
(mVersion == other.mVersion);
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
uintptr_t GetEnd() const { return mEnd; }
|
||||
uintptr_t GetOffset() const { return mOffset; }
|
||||
const std::string &GetBreakpadId() const { return mBreakpadId; }
|
||||
const nsString &GetName() const { return mName; }
|
||||
const nsString &GetModuleName() const { return mModuleName; }
|
||||
const std::string GetNativeDebugName() const {
|
||||
nsAutoCString debugNameStr;
|
||||
|
||||
|
@ -97,7 +97,7 @@ private:
|
|||
uintptr_t mEnd;
|
||||
uintptr_t mOffset;
|
||||
std::string mBreakpadId;
|
||||
nsString mName;
|
||||
nsString mModuleName;
|
||||
nsString mDebugName;
|
||||
std::string mVersion;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче