aboutsummaryrefslogtreecommitdiff
path: root/src/common/mac
diff options
context:
space:
mode:
authornealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2008-11-03 23:23:50 +0000
committernealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e>2008-11-03 23:23:50 +0000
commitc85fb043ed69145a38b3680571924f376b660bcd (patch)
tree653c2c89ff070224609fb2b188b8aa5f81c35bed /src/common/mac
parentUndo suspend/resume feature since it was meant as a workaround to a bug in ho... (diff)
downloadbreakpad-c85fb043ed69145a38b3680571924f376b660bcd.tar.xz
Fix for dump_syms to ignore line number information for addresses that don't have an enclosing function
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@293 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/common/mac')
-rw-r--r--src/common/mac/dump_syms.mm41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm
index 34d811de..5d96a741 100644
--- a/src/common/mac/dump_syms.mm
+++ b/src/common/mac/dump_syms.mm
@@ -963,7 +963,9 @@ static BOOL WriteFormat(int fd, const char *fmt, ...) {
NSNumber *nextAddress;
uint64_t nextAddressVal;
unsigned int addressCount = [sortedAddresses count];
-
+
+ bool insideFunction = false;
+
for (unsigned int i = 0; i < addressCount; ++i) {
NSNumber *address = [sortedAddresses objectAtIndex:i];
// skip sources that have a starting address of 0
@@ -1048,8 +1050,10 @@ static BOOL WriteFormat(int fd, const char *fmt, ...) {
if (line) {
if (symbol && functionLength) {
+
uint64_t functionLengthVal = [functionLength unsignedLongLongValue];
-
+
+ insideFunction = true;
// sanity check to make sure the length we were told does not exceed
// the space between this function and the next
if (nextFunctionAddress != 0) {
@@ -1066,25 +1070,30 @@ static BOOL WriteFormat(int fd, const char *fmt, ...) {
return NO;
}
- // Source line
- uint64_t length = nextAddressVal - addressVal;
-
- // if fileNameToFileIndex/dict has an entry for the
- // file/kFunctionFileKey, we're processing DWARF and have stored
- // files for each program counter. If there is no entry, we're
- // processing STABS and can use the old method of mapping
- // addresses to files(which was basically iterating over a set
- // of addresses until we reached one that was greater than the
- // high PC of the current file, then moving on to the next file)
- NSNumber *fileIndex = [fileNameToFileIndex objectForKey:[dict objectForKey:kFunctionFileKey]];
- if (!WriteFormat(fd, "%llx %llx %d %d\n", addressVal, length,
- [line unsignedIntValue], fileIndex ? [fileIndex unsignedIntValue] : fileIdx))
- return NO;
+ // Throw out line number information that doesn't correspond to
+ // any function
+ if (insideFunction) {
+ // Source line
+ uint64_t length = nextAddressVal - addressVal;
+
+ // if fileNameToFileIndex/dict has an entry for the
+ // file/kFunctionFileKey, we're processing DWARF and have stored
+ // files for each program counter. If there is no entry, we're
+ // processing STABS and can use the old method of mapping
+ // addresses to files(which was basically iterating over a set
+ // of addresses until we reached one that was greater than the
+ // high PC of the current file, then moving on to the next file)
+ NSNumber *fileIndex = [fileNameToFileIndex objectForKey:[dict objectForKey:kFunctionFileKey]];
+ if (!WriteFormat(fd, "%llx %llx %d %d\n", addressVal, length,
+ [line unsignedIntValue], fileIndex ? [fileIndex unsignedIntValue] : fileIdx))
+ return NO;
+ }
} else {
// PUBLIC <address> <stack-size> <name>
if (!WriteFormat(fd, "PUBLIC %llx 0 %s\n", addressVal,
[symbol UTF8String]))
return NO;
+ insideFunction = false;
}
}