Cygwin: Drop excluded regions list from dumper

Drop excluded regions, now it's always empty
This commit is contained in:
Jon Turney 2020-07-04 15:57:31 +01:00
parent 0302c69164
commit 44103c0621
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
2 changed files with 4 additions and 61 deletions

View File

@ -83,7 +83,6 @@ dumper::dumper (DWORD pid, DWORD tid, const char *file_name)
this->pid = pid;
this->tid = tid;
core_bfd = NULL;
excl_list = new exclusion (20);
list = last = NULL;
@ -125,19 +124,16 @@ dumper::close ()
{
if (core_bfd)
bfd_close (core_bfd);
if (excl_list)
delete excl_list;
if (hProcess)
CloseHandle (hProcess);
core_bfd = NULL;
hProcess = NULL;
excl_list = NULL;
}
int
dumper::sane ()
{
if (hProcess == NULL || core_bfd == NULL || excl_list == NULL)
if (hProcess == NULL || core_bfd == NULL)
return 0;
return 1;
}
@ -226,42 +222,6 @@ dumper::add_mem_region (LPBYTE base, SIZE_T size)
return 1;
}
/* split_add_mem_region scans list of regions to be excluded from dumping process
(excl_list) and removes all "excluded" parts from given region. */
int
dumper::split_add_mem_region (LPBYTE base, SIZE_T size)
{
if (!sane ())
return 0;
if (base == NULL || size == 0)
return 1; // just ignore empty regions
LPBYTE last_base = base;
for (process_mem_region * p = excl_list->region;
p < excl_list->region + excl_list->last;
p++)
{
if (p->base >= base + size || p->base + p->size <= base)
continue;
if (p->base <= base)
{
last_base = p->base + p->size;
continue;
}
add_mem_region (last_base, p->base - last_base);
last_base = p->base + p->size;
}
if (last_base < base + size)
add_mem_region (last_base, base + size - last_base);
return 1;
}
int
dumper::add_module (LPVOID base_address)
{
@ -413,14 +373,14 @@ dumper::collect_memory_sections ()
last_size += mbi.RegionSize;
else
{
split_add_mem_region (last_base, last_size);
add_mem_region (last_base, last_size);
last_base = (LPBYTE) mbi.BaseAddress;
last_size = mbi.RegionSize;
}
}
else
{
split_add_mem_region (last_base, last_size);
add_mem_region (last_base, last_size);
last_base = NULL;
last_size = 0;
}
@ -429,7 +389,7 @@ dumper::collect_memory_sections ()
}
/* dump last sections, if any */
split_add_mem_region (last_base, last_size);
add_mem_region (last_base, last_size);
return 1;
};

View File

@ -62,22 +62,6 @@ typedef struct _process_entity
struct _process_entity* next;
} process_entity;
class exclusion
{
public:
size_t last;
size_t size;
size_t step;
process_mem_region* region;
exclusion ( size_t step ) { last = size = 0;
this->step = step;
region = NULL; }
~exclusion () { free ( region ); }
int add ( LPBYTE mem_base, SIZE_T mem_size );
int sort_and_check ();
};
#define PAGE_BUFFER_SIZE 4096
class dumper
@ -87,7 +71,6 @@ class dumper
HANDLE hProcess;
process_entity* list;
process_entity* last;
exclusion* excl_list;
char* file_name;
bfd* core_bfd;