duliangang / google-breakpad

Automatically exported from code.google.com/p/google-breakpad
0 stars 0 forks source link

When creating minidumps without a crash on iOS, only the first minidump is created properly. #555

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When creating minidumps without a crash on iOS, only the first minidump is 
created properly.

The following code snippet can be used to generate minidumps without a crash:

    BreakpadController* bp = [BreakpadController sharedInstance];

    void(^block)(BreakpadRef) = ^(BreakpadRef ref)
    {
        NSDictionary* params = [[NSDictionary alloc] init];
        NSDictionary* bag = BreakpadGenerateReport( ref, params );

        for (NSString* key in bag)
        {
            NSString* value = [bag objectForKey:key];
            NSLog( @"  KEY=\"%@\", VALUE=\"%@\"", key, value );
        }
        NSLog( @"  --(no more keys)--" );        
    };

    [bp withBreakpadRef:block];

The first minidump is always created fine, but all other minidumps (even from a 
crash) are only partially created.  The logging of the dictionary (from the 
code snippet) will only be produced for the first minidump.

The failure occurs in minidump_file_writer.cc in the method bool 
MinidumpFileWriter::Copy( MDRVA, const void*, ssize_t).

The error occurs after a significant part of the minidump is created.   The 
error come from the lseek with an error code EBADF.

#else
  if (lseek(file_, position, SEEK_SET) == static_cast<off_t>(position)) {
    if (write(file_, src, size) == size) {
#endif
      return true;
    }
  }

There is no obvious reason for the file descriptor to suddenly became bad.

Original issue reported on code.google.com by sci...@gmail.com on 12 Dec 2013 at 10:56

GoogleCodeExporter commented 9 years ago

Original comment by qsr@chromium.org on 12 Dec 2013 at 10:58