Skip to content

Commit

Permalink
feat: save Elf BuildId in corefile.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaolei0505 committed Oct 19, 2022
1 parent b779aa2 commit fbfd0b2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/platform/unix/core/linux/elfcore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,13 @@ static int CreateElfCore(void* handle,
mappings[i].end_address - mappings[i].start_address;
}

/* We could save the first page of ELF to record the BuildId,
* let the debugger later find the corresponding binary it used.
*/
if (!dontdump && (mappings[i].flags & PF_X) != 0) {
mappings[i].write_size = pagesize;
}

/* Remove mapping, if it was not readable, or completely zero
* anyway. The former is usually the case of stack guard pages, and
* the latter occasionally happens for unused memory.
Expand Down

0 comments on commit fbfd0b2

Please sign in to comment.