karimjimo / google-breakpad

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

GetMainModule() incorrectly returns module with lowest memory address #454

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The wrong module is returned when using the breakpad library (libbreakpad.a) to 
retrieve the main application module from a crash dump.

What steps will reproduce the problem?
1. Include minidump.h and link against the breakpad library (libbreakpad.a)
2. Open and read a 64-bit dump (sample one attached)
3. Get the list of modules: 
      MinidumpModuleList* moduleList = dump.GetModuleList();
5. Get the main module
      moduleList->GetMainModule();
6. Compare it to the first module in the list:
      moduleList->GetModuleAtIndex(0);

What is the expected output? What do you see instead?

Every 64-bit dump I have tried to get the main module from returns the wrong 
answer. MinidumpModuleList::GetMainModule() (in minidump.cc) is simply 
returning the module with the lowest memory address. I believe this is because 
it is incorrectly using GetModuleAtSequence(0) instead of GetModuleAtIndex(0);

What version of the product are you using? On what operating system?
- Sync'd to Google Breakpad trunk from November 8th, 2011
- Linux RHEL5.3 and Ubuntu 11.10

Please provide any additional information below.

I attach a sample program that reproduces the issue (GetMainModuleTest.cc). 
Seems like an easy fix. Let me know if you need a hand, I just don't  know the 
protocol for submitting fixes. 

The assumption that seems to be made is that the main module is always the 
first on the list, and I guess that for 32-bit dumps that happened to coincide 
with the lowest load address. The problem has probably been masked by the fact 
that most breakpad users simply get the application name and version from 
metadata attached to the report, but we don' t have such metadata, so we were 
trying to get the information straight from the dump. 

Original issue reported on code.google.com by alejandr...@gmail.com on 16 Nov 2011 at 5:28

Attachments:

GoogleCodeExporter commented 9 years ago
These patches (authored by mkrebs@chromium.org) should fix the issue:
https://breakpad.appspot.com/366001
https://breakpad.appspot.com/366002

Original comment by benc...@chromium.org on 29 Mar 2012 at 10:09

GoogleCodeExporter commented 9 years ago
Thank you!

Original comment by alejandr...@gmail.com on 30 Mar 2012 at 5:13