mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 18:51:28 +00:00
Clean up stack trace output: add displacements and remove spaces that sometimes appear in demangled symbols (so my perl script doesn't barf).
This commit is contained in:
parent
1ffc33fded
commit
c621cde475
@ -199,16 +199,23 @@ nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
|
||||
if (ok) {
|
||||
int nameLen = strlen(symbol->Name);
|
||||
if (nameLen + 2 > aBufLen) {
|
||||
if (nameLen + 12 > aBufLen) { // 12 == strlen("+0x12345678 ")
|
||||
break;
|
||||
}
|
||||
memcpy(cp, symbol->Name, nameLen);
|
||||
cp += nameLen;
|
||||
*cp++ = ' ';
|
||||
aBufLen -= nameLen + 1;
|
||||
char* cp2 = symbol->Name;
|
||||
while (*cp2) {
|
||||
if (*cp2 == ' ') *cp2 = '_'; // replace spaces with underscores
|
||||
*cp++ = *cp2++;
|
||||
}
|
||||
aBufLen -= nameLen;
|
||||
char tmp[30];
|
||||
PR_snprintf(tmp, sizeof(tmp), "+0x%08x ", displacement);
|
||||
memcpy(cp, tmp, 12);
|
||||
cp += 12;
|
||||
aBufLen -= nameLen + 12;
|
||||
}
|
||||
else {
|
||||
if (11 > aBufLen) {
|
||||
if (11 > aBufLen) { // 11 == strlen("0x12345678 ")
|
||||
break;
|
||||
}
|
||||
char tmp[30];
|
||||
|
@ -199,16 +199,23 @@ nsTraceRefcnt::WalkTheStack(char* aBuffer, int aBufLen)
|
||||
|
||||
if (ok) {
|
||||
int nameLen = strlen(symbol->Name);
|
||||
if (nameLen + 2 > aBufLen) {
|
||||
if (nameLen + 12 > aBufLen) { // 12 == strlen("+0x12345678 ")
|
||||
break;
|
||||
}
|
||||
memcpy(cp, symbol->Name, nameLen);
|
||||
cp += nameLen;
|
||||
*cp++ = ' ';
|
||||
aBufLen -= nameLen + 1;
|
||||
char* cp2 = symbol->Name;
|
||||
while (*cp2) {
|
||||
if (*cp2 == ' ') *cp2 = '_'; // replace spaces with underscores
|
||||
*cp++ = *cp2++;
|
||||
}
|
||||
aBufLen -= nameLen;
|
||||
char tmp[30];
|
||||
PR_snprintf(tmp, sizeof(tmp), "+0x%08x ", displacement);
|
||||
memcpy(cp, tmp, 12);
|
||||
cp += 12;
|
||||
aBufLen -= nameLen + 12;
|
||||
}
|
||||
else {
|
||||
if (11 > aBufLen) {
|
||||
if (11 > aBufLen) { // 11 == strlen("0x12345678 ")
|
||||
break;
|
||||
}
|
||||
char tmp[30];
|
||||
|
Loading…
Reference in New Issue
Block a user