This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] libdwfl: Special case linux-gate/vdso.so in core_file_read_eagerly.


linux-gate or linux-vdso might be available in the core file, but not
on disk, even if we have a build-id. Try to read them in to make sure
symbols and unwind information are always available for them. We would
already map them in if the core file was opened with ELF_C_READ_MMAP.

https://bugzilla.redhat.com/show_bug.cgi?id=1129756

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libdwfl/ChangeLog   |  5 +++++
 libdwfl/core-file.c | 13 +++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index d40dbae..68cf9f0 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Mark Wielaard  <mjw@redhat.com>
+
+	* core-file.c (core_file_read_eagerly): Special case linux-gate
+	and linux-vdso.
+
 2015-01-26  Mark Wielaard  <mjw@redhat.com>
 
 	* dwfl_module_getdwarf.c (find_symtab): Explicitly clear symdata,
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index 50031ae..a3ac8a8 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -1,5 +1,5 @@
 /* Core file handling.
-   Copyright (C) 2008-2010, 2013 Red Hat, Inc.
+   Copyright (C) 2008-2010, 2013, 2015 Red Hat, Inc.
    This file is part of elfutils.
 
    This file is free software; you can redistribute it and/or modify
@@ -164,7 +164,7 @@ dwfl_report_core_segments (Dwfl *dwfl, Elf *elf, size_t phnum, GElf_Phdr *notes)
 static bool
 core_file_read_eagerly (Dwfl_Module *mod,
 			void **userdata __attribute__ ((unused)),
-			const char *name __attribute__ ((unused)),
+			const char *name,
 			Dwarf_Addr start __attribute__ ((unused)),
 			void **buffer, size_t *buffer_available,
 			GElf_Off cost, GElf_Off worthwhile,
@@ -212,10 +212,15 @@ core_file_read_eagerly (Dwfl_Module *mod,
     requires find_elf hook re-doing the magic to fall back if no file found
   */
 
-  if (mod->build_id_len > 0)
+  if (mod->build_id_len > 0
+      && strcmp ("linux-gate.so.1", name) != 0
+      && strcmp ("linux-vdso.so.1", name) != 0
+      && strcmp ("linux-vdso32.so.1", name) != 0
+      && strcmp ("linux-vdso64.so.1", name) != 0)
     /* There is a build ID that could help us find the whole file,
        which might be more useful than what we have.
-       We'll just rely on that.  */
+       We'll just rely on that.  Special hack for linux-gate and
+       linux-vdso since those might not actually be found on disk.  */
     return false;
 
   if (core->map_address != NULL)
-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]