fixes for issue 128: reviewed by Waylonis

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@124 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ladderbreaker
2007-03-08 23:47:37 +00:00
parent fce2508282
commit 530a7ad99e
3 changed files with 63 additions and 4 deletions

View File

@@ -184,9 +184,6 @@ bool MinidumpGenerator::Write(const char *path) {
return result;
}
// TODO(waylonis): This routine works most of the time. However, if a process
// fork()s, it might cause the stack so that the current top of stack will
// exist on a single page.
static size_t CalculateStackSize(vm_address_t start_addr) {
vm_address_t stack_region_base = start_addr;
vm_size_t stack_region_size;
@@ -199,6 +196,17 @@ static size_t CalculateStackSize(vm_address_t start_addr) {
reinterpret_cast<vm_region_recurse_info_t>(&submap_info),
&info_count);
if ((stack_region_base + stack_region_size) == 0xbffff000) {
// The stack for thread 0 needs to extend all the way to 0xc0000000
// For many processes the stack is first created in one page
// from 0xbffff000 - 0xc0000000 and is then later extended to
// a much larger size by creating a new VM region immediately below
// the initial page
// include the original stack frame page (0xbffff000 - 0xc0000000)
stack_region_size += 0x1000;
}
return result == KERN_SUCCESS ?
stack_region_base + stack_region_size - start_addr : 0;
}
@@ -224,7 +232,6 @@ bool MinidumpGenerator::WriteStackFromStartAddress(
return result;
}
#if TARGET_CPU_PPC
bool MinidumpGenerator::WriteStack(thread_state_data_t state,
MDMemoryDescriptor *stack_location) {
@@ -393,6 +400,7 @@ bool MinidumpGenerator::WriteThreadListStream(
MDRawThread thread;
int thread_idx = 0;
for (unsigned int i = 0; i < thread_count; ++i) {
memset(&thread, 0, sizeof(MDRawThread));