This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[commit] [patch] Fix a regression of dwfl_core_file_report retval
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 07 Nov 2013 21:30:57 +0100
- Subject: [commit] [patch] Fix a regression of dwfl_core_file_report retval
On Thu, 07 Nov 2013 21:22:01 +0100, Mark Wielaard wrote:
> Your version is indeed right. I misread the comment.
> I missed the "if there was an error" part. Doh.
Therefore checked in. Although as two parts as I forgot about the one change.
Thanks,
Jan
commit b947ee100ac604a2f6877a790b57bdf80e4123d5
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Thu Nov 7 21:27:54 2013 +0100
dwfl_core_file_report: Fix a regression of dwfl_core_file_report retval
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 7f36bdf..2355cc5 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,10 @@
2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * core-file.c (dwfl_core_file_report): Replaced variable sniffed by
+ retval. Fix one forgotten LISTED increase.
+
+2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+
Fix core files for re-prelink-ed files.
* core-file.c (dynamic_vaddr_get): New function.
(dwfl_core_file_report): New variable file_dynamic_vaddr. Call
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index 665fcf7..72a44f8 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -483,14 +483,14 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
struct r_debug_info r_debug_info;
memset (&r_debug_info, 0, sizeof r_debug_info);
- int listed = dwfl_link_map_report (dwfl, auxv, auxv_size,
+ int retval = dwfl_link_map_report (dwfl, auxv, auxv_size,
dwfl_elf_phdr_memory_callback, elf,
&r_debug_info);
+ int listed = MAX (0, retval);
/* Now sniff segment contents for modules hinted by information gathered
from DT_DEBUG. */
- int sniffed = 0;
ndx = 0;
do
{
@@ -506,7 +506,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
if (seg > ndx)
{
ndx = seg;
- ++sniffed;
+ ++listed;
}
else
++ndx;
@@ -534,6 +534,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
true, true);
if (mod == NULL)
continue;
+ ++listed;
module->elf = NULL;
module->fd = -1;
/* Move this module to the end of the list, so that we end
@@ -560,7 +561,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
/* We return the number of modules we found if we found any.
If we found none, we return -1 instead of 0 if there was an
error rather than just nothing found. */
- return sniffed || listed >= 0 ? listed + sniffed : listed;
+ return listed > 0 ? listed : retval;
}
INTDEF (dwfl_core_file_report)
NEW_VERSION (dwfl_core_file_report, ELFUTILS_0.158)
commit 22f867adcc1258aeb88560fa8591ef071353bb22
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date: Thu Nov 7 21:30:17 2013 +0100
dwfl_core_file_report: Remove the use of MAX.
Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 2355cc5..dc59921 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,5 +1,9 @@
2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+ * core-file.c (dwfl_core_file_report): Remove the use of MAX.
+
+2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
+
* core-file.c (dwfl_core_file_report): Replaced variable sniffed by
retval. Fix one forgotten LISTED increase.
diff --git a/libdwfl/core-file.c b/libdwfl/core-file.c
index 72a44f8..4f66983 100644
--- a/libdwfl/core-file.c
+++ b/libdwfl/core-file.c
@@ -486,7 +486,7 @@ dwfl_core_file_report (Dwfl *dwfl, Elf *elf, const char *executable)
int retval = dwfl_link_map_report (dwfl, auxv, auxv_size,
dwfl_elf_phdr_memory_callback, elf,
&r_debug_info);
- int listed = MAX (0, retval);
+ int listed = retval > 0 ? retval : 0;
/* Now sniff segment contents for modules hinted by information gathered
from DT_DEBUG. */