зеркало из 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++) {
|
for (unsigned int i = 0, n = mRawModules.GetSize(); i != n; i++) {
|
||||||
const SharedLibrary &info = mRawModules.GetEntry(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));
|
JS::RootedObject moduleObj(cx, JS_NewPlainObject(cx));
|
||||||
if (!moduleObj) {
|
if (!moduleObj) {
|
||||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||||
|
@ -1717,7 +1701,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module name.
|
// 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)) {
|
if (!moduleName || !JS_DefineProperty(cx, moduleObj, "name", moduleName, JSPROP_ENUMERATE)) {
|
||||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1726,8 +1710,8 @@ public:
|
||||||
// Module debug name.
|
// Module debug name.
|
||||||
JS::RootedValue moduleDebugName(cx);
|
JS::RootedValue moduleDebugName(cx);
|
||||||
|
|
||||||
if (!debug_basename.IsEmpty()) {
|
if (!info.GetDebugName().IsEmpty()) {
|
||||||
JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, debug_basename.get()));
|
JS::RootedString str_moduleDebugName(cx, JS_NewUCStringCopyZ(cx, info.GetDebugName().get()));
|
||||||
if (!str_moduleDebugName) {
|
if (!str_moduleDebugName) {
|
||||||
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
mPromise->MaybeReject(NS_ERROR_FAILURE);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -3228,18 +3212,8 @@ GetStackAndModules(const std::vector<uintptr_t>& aPCs)
|
||||||
#ifdef MOZ_GECKO_PROFILER
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) {
|
for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) {
|
||||||
const SharedLibrary &info = rawModules.GetEntry(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 = {
|
mozilla::Telemetry::ProcessedStack::Module module = {
|
||||||
basename,
|
info.GetDebugName(),
|
||||||
info.GetBreakpadId()
|
info.GetBreakpadId()
|
||||||
};
|
};
|
||||||
Ret.AddModule(module);
|
Ret.AddModule(module);
|
||||||
|
|
|
@ -81,12 +81,17 @@ dl_iterate_callback(struct dl_phdr_info *dl_info, size_t size, void *data)
|
||||||
if (end > libEnd)
|
if (end > libEnd)
|
||||||
libEnd = end;
|
libEnd = end;
|
||||||
}
|
}
|
||||||
const char *name = dl_info->dlpi_name;
|
const char *path = dl_info->dlpi_name;
|
||||||
|
|
||||||
nsAutoString nameStr;
|
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);
|
info.AddSharedLibrary(shlib);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -126,10 +131,10 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||||
unsigned long end;
|
unsigned long end;
|
||||||
char perm[6] = "";
|
char perm[6] = "";
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
char name[PATH_MAX] = "";
|
char modulePath[PATH_MAX] = "";
|
||||||
ret = sscanf(line.c_str(),
|
ret = sscanf(line.c_str(),
|
||||||
"%lx-%lx %6s %lx %*s %*x %" PATH_MAX_STRING(PATH_MAX) "s\n",
|
"%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')) {
|
if (!strchr(perm, 'x')) {
|
||||||
// Ignore non executable entries
|
// Ignore non executable entries
|
||||||
continue;
|
continue;
|
||||||
|
@ -141,7 +146,7 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||||
#if defined(PROFILE_JAVA)
|
#if defined(PROFILE_JAVA)
|
||||||
// Use proc/pid/maps to get the dalvik-jit section since it has
|
// Use proc/pid/maps to get the dalvik-jit section since it has
|
||||||
// no associated phdrs
|
// no associated phdrs
|
||||||
if (strcmp(name, "/dev/ashmem/dalvik-jit-code-cache") != 0) {
|
if (strcmp(modulePath, "/dev/ashmem/dalvik-jit-code-cache") != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -154,7 +159,12 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsAutoString nameStr;
|
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, "");
|
SharedLibrary shlib(start, end, offset, getId(name), nameStr, nameStr, "");
|
||||||
info.AddSharedLibrary(shlib);
|
info.AddSharedLibrary(shlib);
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef segment_command_64 mach_segment_command_type;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static
|
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 =
|
const struct load_command *cmd =
|
||||||
reinterpret_cast<const struct load_command *>(header + 1);
|
reinterpret_cast<const struct load_command *>(header + 1);
|
||||||
|
|
||||||
|
@ -73,7 +73,12 @@ void addSharedLibrary(const platform_mach_header* header, char *name, SharedLibr
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString nameStr;
|
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(),
|
info.AddSharedLibrary(SharedLibrary(start, start + size, 0, uuid.str(),
|
||||||
nameStr, nameStr, ""));
|
nameStr, nameStr, ""));
|
||||||
|
|
|
@ -182,17 +182,17 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString moduleName(modulePath);
|
nsAutoString moduleNameStr(modulePath);
|
||||||
int32_t pos = moduleName.RFindChar('\\');
|
int32_t pos = moduleNameStr.RFindChar('\\');
|
||||||
if (pos != kNotFound) {
|
if (pos != kNotFound) {
|
||||||
moduleName.Cut(0, pos + 1);
|
moduleNameStr.Cut(0, pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedLibrary shlib((uintptr_t)module.lpBaseOfDll,
|
SharedLibrary shlib((uintptr_t)module.lpBaseOfDll,
|
||||||
(uintptr_t)module.lpBaseOfDll + module.SizeOfImage,
|
(uintptr_t)module.lpBaseOfDll + module.SizeOfImage,
|
||||||
0, // DLLs are always mapped at offset 0 on Windows
|
0, // DLLs are always mapped at offset 0 on Windows
|
||||||
breakpadId,
|
breakpadId,
|
||||||
moduleName,
|
moduleNameStr,
|
||||||
pdbNameStr,
|
pdbNameStr,
|
||||||
GetVersion(modulePath));
|
GetVersion(modulePath));
|
||||||
sharedLibraryInfo.AddSharedLibrary(shlib);
|
sharedLibraryInfo.AddSharedLibrary(shlib);
|
||||||
|
|
|
@ -27,14 +27,14 @@ public:
|
||||||
uintptr_t aEnd,
|
uintptr_t aEnd,
|
||||||
uintptr_t aOffset,
|
uintptr_t aOffset,
|
||||||
const std::string& aBreakpadId,
|
const std::string& aBreakpadId,
|
||||||
const nsString& aName,
|
const nsString& aModuleName,
|
||||||
const nsString& aDebugName,
|
const nsString& aDebugName,
|
||||||
const std::string& aVersion)
|
const std::string& aVersion)
|
||||||
: mStart(aStart)
|
: mStart(aStart)
|
||||||
, mEnd(aEnd)
|
, mEnd(aEnd)
|
||||||
, mOffset(aOffset)
|
, mOffset(aOffset)
|
||||||
, mBreakpadId(aBreakpadId)
|
, mBreakpadId(aBreakpadId)
|
||||||
, mName(aName)
|
, mModuleName(aModuleName)
|
||||||
, mDebugName(aDebugName)
|
, mDebugName(aDebugName)
|
||||||
, mVersion(aVersion)
|
, mVersion(aVersion)
|
||||||
{}
|
{}
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
, mEnd(aEntry.mEnd)
|
, mEnd(aEntry.mEnd)
|
||||||
, mOffset(aEntry.mOffset)
|
, mOffset(aEntry.mOffset)
|
||||||
, mBreakpadId(aEntry.mBreakpadId)
|
, mBreakpadId(aEntry.mBreakpadId)
|
||||||
, mName(aEntry.mName)
|
, mModuleName(aEntry.mModuleName)
|
||||||
, mDebugName(aEntry.mDebugName)
|
, mDebugName(aEntry.mDebugName)
|
||||||
, mVersion(aEntry.mVersion)
|
, mVersion(aEntry.mVersion)
|
||||||
{}
|
{}
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
mEnd = aEntry.mEnd;
|
mEnd = aEntry.mEnd;
|
||||||
mOffset = aEntry.mOffset;
|
mOffset = aEntry.mOffset;
|
||||||
mBreakpadId = aEntry.mBreakpadId;
|
mBreakpadId = aEntry.mBreakpadId;
|
||||||
mName = aEntry.mName;
|
mModuleName = aEntry.mModuleName;
|
||||||
mDebugName = aEntry.mDebugName;
|
mDebugName = aEntry.mDebugName;
|
||||||
mVersion = aEntry.mVersion;
|
mVersion = aEntry.mVersion;
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
return (mStart == other.mStart) &&
|
return (mStart == other.mStart) &&
|
||||||
(mEnd == other.mEnd) &&
|
(mEnd == other.mEnd) &&
|
||||||
(mOffset == other.mOffset) &&
|
(mOffset == other.mOffset) &&
|
||||||
(mName == other.mName) &&
|
(mModuleName == other.mModuleName) &&
|
||||||
(mDebugName == other.mDebugName) &&
|
(mDebugName == other.mDebugName) &&
|
||||||
(mBreakpadId == other.mBreakpadId) &&
|
(mBreakpadId == other.mBreakpadId) &&
|
||||||
(mVersion == other.mVersion);
|
(mVersion == other.mVersion);
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
uintptr_t GetEnd() const { return mEnd; }
|
uintptr_t GetEnd() const { return mEnd; }
|
||||||
uintptr_t GetOffset() const { return mOffset; }
|
uintptr_t GetOffset() const { return mOffset; }
|
||||||
const std::string &GetBreakpadId() const { return mBreakpadId; }
|
const std::string &GetBreakpadId() const { return mBreakpadId; }
|
||||||
const nsString &GetName() const { return mName; }
|
const nsString &GetModuleName() const { return mModuleName; }
|
||||||
const std::string GetNativeDebugName() const {
|
const std::string GetNativeDebugName() const {
|
||||||
nsAutoCString debugNameStr;
|
nsAutoCString debugNameStr;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ private:
|
||||||
uintptr_t mEnd;
|
uintptr_t mEnd;
|
||||||
uintptr_t mOffset;
|
uintptr_t mOffset;
|
||||||
std::string mBreakpadId;
|
std::string mBreakpadId;
|
||||||
nsString mName;
|
nsString mModuleName;
|
||||||
nsString mDebugName;
|
nsString mDebugName;
|
||||||
std::string mVersion;
|
std::string mVersion;
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче