struct elf_prstatus *prstatus = NULL; ///< NT_PRSTATUS of the failed process
size_t size = 0;
char *registers = _crash_stack_get_memory_for_registers(&size);
+ int ret = -1;
if (NULL == registers) {
_E("Cannot get memory for registers (not implemented for this architecture");
if (prstatus == MAP_FAILED)
return -1;
- if (prstatus->pr_pid != pid)
- return -1;
+ if (prstatus->pr_pid == pid) {
+ memcpy(registers, prstatus->pr_reg, size);
+ ret = 0;
+ }
- memcpy(registers, prstatus->pr_reg, size);
+ munmap(prstatus, sizeof(struct elf_prstatus));
- return 0;
+ return ret;
}
/**
region->data_head->data = data;
region->data_head->length = length;
- region->data_index = malloc(sizeof(struct mem_data_chunk**));
+ region->data_index = malloc(sizeof(struct mem_data_chunk*));
if (region->data_index == NULL){
_E("Unable to allocate memory:%m");
free(region->data_head);
if ((region->data_head->data = (char *)get_vdso()) == NULL)
return -1;
- region->data_index = malloc(sizeof(struct mem_data_chunk**));
+ region->data_index = malloc(sizeof(struct mem_data_chunk*));
if (region->data_index == NULL) {
_E("Unable to allocate memory:%m");
return -1;
region->data_head->start = region->start;
region->data_head->data = (char *)VSYSCALL_START;
region->data_head->length = region->length;
- region->data_index = malloc(sizeof(struct mem_data_chunk**));
+ region->data_index = malloc(sizeof(struct mem_data_chunk*));
if (region->data_index == NULL) {
_E("Unable to allocate memory:%m");
return -1;