зеркало из https://github.com/mozilla/gecko-dev.git
bug 751673 - fix Windows assertion stacks. r=dbaron
--HG-- extra : rebase_source : b74882bb3914afaa44341088b9f737c909e88f65
This commit is contained in:
Родитель
c818a9f25e
Коммит
f5ce90e65a
|
@ -1015,7 +1015,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
|||
else:
|
||||
logsource = proc.stdout
|
||||
|
||||
if self.IS_DEBUG_BUILD and (self.IS_MAC or self.IS_LINUX) and symbolsPath and os.path.exists(symbolsPath):
|
||||
if self.IS_DEBUG_BUILD and symbolsPath and os.path.exists(symbolsPath):
|
||||
# Run each line through a function in fix_stack_using_bpsyms.py (uses breakpad symbol files)
|
||||
# This method is preferred for Tinderbox builds, since native symbols may have been stripped.
|
||||
sys.path.insert(0, utilityPath)
|
||||
|
|
|
@ -17,13 +17,15 @@ def prettyFileName(name):
|
|||
# and/or don't correspond to the layout of the source tree.
|
||||
return os.path.basename(name) + ":"
|
||||
elif name.startswith("hg:"):
|
||||
(junk, repo, path, rev) = name.split(":")
|
||||
# We could construct an hgweb URL with /file/ or /annotate/, like this:
|
||||
# return "http://%s/annotate/%s/%s#l" % (repo, rev, path)
|
||||
return path + ":"
|
||||
bits = name.split(":")
|
||||
if len(bits) == 4:
|
||||
(junk, repo, path, rev) = bits
|
||||
# We could construct an hgweb URL with /file/ or /annotate/, like this:
|
||||
# return "http://%s/annotate/%s/%s#l" % (repo, rev, path)
|
||||
return path + ":"
|
||||
return name + ":"
|
||||
|
||||
class readSymbolFile:
|
||||
class SymbolFile:
|
||||
def __init__(self, fn):
|
||||
addrs = [] # list of addresses, which will be sorted once we're done initializing
|
||||
funcs = {} # hash: address --> (function name + possible file/line)
|
||||
|
@ -62,6 +64,7 @@ class readSymbolFile:
|
|||
#print "Loaded %d functions from symbol file %s" % (len(funcs), os.path.basename(fn))
|
||||
self.addrs = sorted(addrs)
|
||||
self.funcs = funcs
|
||||
|
||||
def addrToSymbol(self, address):
|
||||
i = bisect.bisect(self.addrs, address) - 1
|
||||
if i > 0:
|
||||
|
@ -70,38 +73,46 @@ class readSymbolFile:
|
|||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def guessSymbolFile(fn, symbolsDir):
|
||||
"""Guess a symbol file based on an object file's basename, ignoring the path and UUID."""
|
||||
fn = os.path.basename(fn)
|
||||
d1 = os.path.join(symbolsDir, fn)
|
||||
if not os.path.exists(d1):
|
||||
return None
|
||||
fn = fn + ".pdb"
|
||||
d1 = os.path.join(symbolsDir, fn)
|
||||
if not os.path.exists(d1):
|
||||
return None
|
||||
uuids = os.listdir(d1)
|
||||
if len(uuids) == 0:
|
||||
raise Exception("Missing symbol file for " + fn)
|
||||
if len(uuids) > 1:
|
||||
raise Exception("Ambiguous symbol file for " + fn)
|
||||
if fn.endswith(".pdb"):
|
||||
fn = fn[:-4]
|
||||
return os.path.join(d1, uuids[0], fn + ".sym")
|
||||
|
||||
parsedSymbolFiles = {}
|
||||
def addressToSymbol(file, address, symbolsDir):
|
||||
def getSymbolFile(file, symbolsDir):
|
||||
p = None
|
||||
if not file in parsedSymbolFiles:
|
||||
symfile = guessSymbolFile(file, symbolsDir)
|
||||
if symfile:
|
||||
p = readSymbolFile(symfile)
|
||||
p = SymbolFile(symfile)
|
||||
else:
|
||||
p = None
|
||||
parsedSymbolFiles[file] = p
|
||||
else:
|
||||
p = parsedSymbolFiles[file]
|
||||
return p
|
||||
|
||||
def addressToSymbol(file, address, symbolsDir):
|
||||
p = getSymbolFile(file, symbolsDir)
|
||||
if p:
|
||||
return p.addrToSymbol(address)
|
||||
else:
|
||||
return ""
|
||||
|
||||
line_re = re.compile("^(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$")
|
||||
line_re = re.compile("^(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,16})\](.*)$")
|
||||
balance_tree_re = re.compile("^([ \|0-9-]*)")
|
||||
|
||||
def fixSymbols(line, symbolsDir):
|
||||
|
@ -118,7 +129,7 @@ def fixSymbols(line, symbolsDir):
|
|||
symbol = "%s + 0x%x" % (os.path.basename(file), address)
|
||||
return before + symbol + after + "\n"
|
||||
else:
|
||||
return line
|
||||
return line
|
||||
|
||||
if __name__ == "__main__":
|
||||
symbolsDir = sys.argv[1]
|
||||
|
|
|
@ -606,7 +606,7 @@ static BOOL CALLBACK callbackEspecial64(
|
|||
? (addr >= aModuleBase && addr <= (aModuleBase + aModuleSize))
|
||||
: (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
|
||||
) {
|
||||
retval = SymLoadModule64(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
|
||||
retval = !!SymLoadModule64(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
|
||||
if (!retval)
|
||||
PrintError("SymLoadModule64");
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ NS_DescribeCodeAddress(void *aPC, nsCodeAddressDetails *aDetails)
|
|||
if (ok) {
|
||||
PL_strncpyz(aDetails->function, pSymbol->Name,
|
||||
sizeof(aDetails->function));
|
||||
aDetails->foffset = displacement;
|
||||
aDetails->foffset = static_cast<ptrdiff_t>(displacement);
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&gDbgHelpCS); // release our lock
|
||||
|
@ -786,11 +786,16 @@ EXPORT_XPCOM_API(nsresult)
|
|||
NS_FormatCodeAddressDetails(void *aPC, const nsCodeAddressDetails *aDetails,
|
||||
char *aBuffer, uint32_t aBufferSize)
|
||||
{
|
||||
if (aDetails->function[0])
|
||||
_snprintf(aBuffer, aBufferSize, "%s!%s+0x%016lX",
|
||||
aDetails->library, aDetails->function, aDetails->foffset);
|
||||
else
|
||||
_snprintf(aBuffer, aBufferSize, "0x%016lX", aPC);
|
||||
if (aDetails->function[0]) {
|
||||
_snprintf(aBuffer, aBufferSize, "%s+0x%08lX [%s +0x%016lX]",
|
||||
aDetails->function, aDetails->foffset,
|
||||
aDetails->library, aDetails->loffset);
|
||||
} else if (aDetails->library[0]) {
|
||||
_snprintf(aBuffer, aBufferSize, "UNKNOWN [%s +0x%016lX]",
|
||||
aDetails->library, aDetails->loffset);
|
||||
} else {
|
||||
_snprintf(aBuffer, aBufferSize, "UNKNOWN 0x%016lX", aPC);
|
||||
}
|
||||
|
||||
aBuffer[aBufferSize - 1] = '\0';
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче