+2014-09-18 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Use IS_EXECUTABLE.
+ * dwfl_segment_report_module.c (dwfl_segment_report_module): Set
+ IS_EXECUTABLE.
+ * libdwflP.h (struct Dwfl_Module): New field is_executable.
+
2014-08-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwfl_module_getdwarf.c (find_offsets): Add parameter main_bias, use
char **file_name, Elf **elfp)
{
*elfp = NULL;
- if (modname != NULL && mod->dwfl->executable_for_core != NULL
- && (strcmp (modname, "[exe]") == 0 || strcmp (modname, "[pie]") == 0))
+ if (mod->is_executable && mod->dwfl->executable_for_core != NULL)
{
/* When dwfl_core_file_report was called with a non-NULL executable file
name this callback will replace the Dwfl_Module main.name with the
- recorded executable file when the modname is [exe] or [pie] (which
- then triggers opening and reporting of the executable). */
+ recorded executable file when MOD was identified as main executable
+ (which then triggers opening and reporting of the executable). */
int fd = open64 (mod->dwfl->executable_for_core, O_RDONLY);
if (fd >= 0)
{
Dwfl_Module *mod = INTUSE(dwfl_report_module) (dwfl, name,
module_start, module_end);
+
+ // !execlike && ET_EXEC is PIE.
+ // execlike && !ET_EXEC is a static executable.
+ if (mod != NULL && (execlike || ehdr.e32.e_type == ET_EXEC))
+ mod->is_executable = true;
+
if (likely (mod != NULL) && build_id != NULL
&& unlikely (INTUSE(dwfl_module_report_build_id) (mod,
build_id,
int segment; /* Index of first segment table entry. */
bool gc; /* Mark/sweep flag. */
+ bool is_executable; /* Use Dwfl::executable_for_core? */
};
/* This holds information common for all the threads/tasks/TIDs of one process