[prev in list] [next in list] [prev in thread] [next in thread]
List: oprofile-list
Subject: [PATCH] Fix debuginfo processing for non-ppc64 architectures
From: Maynard Johnson <maynardj () us ! ibm ! com>
Date: 2012-01-06 23:17:36
Message-ID: 4F078110.1060503 () us ! ibm ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
The attached patch addresses the debuginfo problem reported by Will Cohen on Oct 20 of last year
(subject "OProfile dropping symbols for prelinked executable"). As mentioned in my Jan 4 post,
this patch fixes debuginfo processing for all architectures except ppc64. A separate patch will
be posted to fix ppc64 debuginfo processing. In short, this patch reverts to old behavior in
that the filtering of non-SEC_LOAD symbols has been removed, allowing debuginfo symbols to
be retained. This eliminates the need for calling the problematic translate_debuginfo_syms
function for all architectures except ppc64.
*Will*, please review/test and give me your feedback.
Thanks.
-Maynard
-----------------------------------------------------------------------
>From 9645742c841b3542f1289ac7b527ab505bdaaaae Mon Sep 17 00:00:00 2001
From: Maynard Johnson <maynardj@us.ibm.com>
Date: Fri, 6 Jan 2012 16:45:29 -0600
Subject: [PATCH] Fix debuginfo processing for non-ppc64 architectures.
Signed-off-by: Maynard Johnson <maynardj@us.ibm.com>
---
libutil++/bfd_support.cpp | 23 +++++++----------------
libutil++/bfd_support.h | 15 +++++++--------
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
index 69d6938..a10651a 100644
--- a/libutil++/bfd_support.cpp
+++ b/libutil++/bfd_support.cpp
@@ -367,9 +367,6 @@ bool interesting_symbol(asymbol * sym)
if (sym->flags & BSF_SECTION_SYM)
return false;
- if (!(sym->section->flags & SEC_LOAD))
- return false;
-
return true;
}
@@ -432,7 +429,14 @@ void bfd_info::close()
bfd_close(abfd);
}
+#if SYNTHESIZE_SYMBOLS
/**
+ * This function is intended solely for processing ppc64 debuginfo files.
+ * On ppc64 platforms where there is no symbol information in the image bfd,
+ * the debuginfo syms need to be mapped back to the sections of the image bfd
+ * when calling bfd_get_synthetic_symtab() to gather complete symbol information.
+ * That is the purpose of the translate_debuginfo_syms() function.
+ *
* This function is only called when processing symbols retrieved from a
* debuginfo file that is separate from the actual runtime binary image.
* Separate debuginfo files may be needed in two different cases:
@@ -440,14 +444,6 @@ void bfd_info::close()
information at all
* 2) the real image has debuginfo stripped, and the user is requesting "-g"
* (src file/line num info)
- * After all symbols are gathered up, there will be some filtering/removal of
- * unnecessary symbols. In particular, the bfd_info::interesting_symbol()
- * function filters out symbols whose section's flag value does not include
- * SEC_LOAD. This filtering is required, so it must be retained. However,
- * we run into a problem with symbols from debuginfo files, since the
- * section flag does NOT include SEC_LOAD. To solve this problem, the
- * translate_debuginfo_syms function maps the debuginfo symbol's sections to
- * that of their corresponding real image.
*/
void bfd_info::translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms)
{
@@ -500,7 +496,6 @@ void bfd_info::translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms)
}
}
-#if SYNTHESIZE_SYMBOLS
bool bfd_info::get_synth_symbols()
{
extern const bfd_target bfd_elf64_powerpc_vec;
@@ -596,10 +591,6 @@ void bfd_info::get_symbols()
syms.reset(new asymbol *[nr_syms]);
nr_syms = bfd_canonicalize_symtab(abfd, syms.get());
-
- if (image_bfd_info)
- translate_debuginfo_syms(syms.get(), nr_syms);
-
cverb << vbfd << "bfd_canonicalize_symtab: " << dec
<< nr_syms << hex << endl;
}
diff --git a/libutil++/bfd_support.h b/libutil++/bfd_support.h
index 4f6a369..7e72d13 100644
--- a/libutil++/bfd_support.h
+++ b/libutil++/bfd_support.h
@@ -14,6 +14,7 @@
#include "utility.h"
#include "op_types.h"
#include "locate_images.h"
+#include "config.h"
#include <bfd.h>
#include <stdint.h>
@@ -72,16 +73,14 @@ private:
*/
bfd_info * image_bfd_info;
- /* To address a different issue, we discard symbols whose section
- * flag does not contain SEC_LOAD. But since this is true for symbols
- * found in debuginfo files, we must run those debuginfo symbols
- * through the function below to prevent them from being inadvertently
- * discarded. This function maps the sections from the symbols in
- * the debuginfo bfd to those of the real image bfd. Then, when
- * we later do symbol filtering, we see the sections from the real
- * bfd, which do contain SEC_LOAD in the section flag.
+#if SYNTHESIZE_SYMBOLS
+ /**
+ * This function is used only for ppc64 binaries. It uses the runtime
+ * image BFD (accessed through image_bfd_info) as needed when processing
+ * debuginfo files.
*/
void translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms);
+#endif
};
--
1.6.2.rc2
[Attachment #5 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<pre><font face="Courier New, Courier, monospace">The attached patch addresses \
the debuginfo problem reported by Will Cohen on Oct 20 of last year (subject \
"OProfile dropping symbols for prelinked executable"). As mentioned in my Jan 4 \
post, this patch fixes debuginfo processing for all architectures except ppc64. A \
separate patch will be posted to fix ppc64 debuginfo processing. In short, this \
patch reverts to old behavior in that the filtering of non-SEC_LOAD symbols has been \
removed, allowing debuginfo symbols to be retained. This eliminates the need for \
calling the problematic translate_debuginfo_syms function for all architectures \
except ppc64.
*Will*, please review/test and give me your feedback.
Thanks.
-Maynard
-----------------------------------------------------------------------
> From 9645742c841b3542f1289ac7b527ab505bdaaaae Mon Sep 17 00:00:00 2001
From: Maynard Johnson <a class="moz-txt-link-rfc2396E" \
href="mailto:maynardj@us.ibm.com"><maynardj@us.ibm.com></a>
Date: Fri, 6 Jan 2012 16:45:29 -0600
Subject: [PATCH] Fix debuginfo processing for non-ppc64 architectures.
Signed-off-by: Maynard Johnson <a class="moz-txt-link-rfc2396E" \
href="mailto:maynardj@us.ibm.com"><maynardj@us.ibm.com></a>
---
libutil++/bfd_support.cpp | 23 +++++++----------------
libutil++/bfd_support.h | 15 +++++++--------
2 files changed, 14 insertions(+), 24 deletions(-)
diff --git a/libutil++/bfd_support.cpp b/libutil++/bfd_support.cpp
index 69d6938..a10651a 100644
--- a/libutil++/bfd_support.cpp
+++ b/libutil++/bfd_support.cpp
@@ -367,9 +367,6 @@ bool interesting_symbol(asymbol * sym)
if (sym->flags & BSF_SECTION_SYM)
return false;
- if (!(sym->section->flags & SEC_LOAD))
- return false;
-
return true;
}
@@ -432,7 +429,14 @@ void bfd_<a class="moz-txt-link-freetext" \
href="info::close()">info::close()</a> bfd_close(abfd);
}
+#if SYNTHESIZE_SYMBOLS
/**
+ * This function is intended solely for processing ppc64 debuginfo files.
+ * On ppc64 platforms where there is no symbol information in the image bfd,
+ * the debuginfo syms need to be mapped back to the sections of the image bfd
+ * when calling bfd_get_synthetic_symtab() to gather complete symbol information.
+ * That is the purpose of the translate_debuginfo_syms() function.
+ *
* This function is only called when processing symbols retrieved from a
* debuginfo file that is separate from the actual runtime binary image.
* Separate debuginfo files may be needed in two different cases:
@@ -440,14 +444,6 @@ void bfd_<a class="moz-txt-link-freetext" \
href="info::close()">info::close()</a> information at all
* 2) the real image has debuginfo stripped, and the user is requesting "-g"
* (src file/line num info)
- * After all symbols are gathered up, there will be some filtering/removal of
- * unnecessary symbols. In particular, the bfd_<a class="moz-txt-link-freetext" \
href="info::interesting_symbol()">info::interesting_symbol()</a>
- * function filters out symbols whose section's flag value does not include
- * SEC_LOAD. This filtering is required, so it must be retained. However,
- * we run into a problem with symbols from debuginfo files, since the
- * section flag does NOT include SEC_LOAD. To solve this problem, the
- * translate_debuginfo_syms function maps the debuginfo symbol's sections to
- * that of their corresponding real image.
*/
void bfd_<a class="moz-txt-link-freetext" \
href="info::translate_debuginfo_syms(asymbol">info::translate_debuginfo_syms(asymbol</a> \
** dbg_syms, long nr_dbg_syms) {
@@ -500,7 +496,6 @@ void bfd_<a class="moz-txt-link-freetext" \
href="info::translate_debuginfo_syms(asymbol">info::translate_debuginfo_syms(asymbol</a> \
** dbg_syms, long nr_dbg_syms) }
}
-#if SYNTHESIZE_SYMBOLS
bool bfd_<a class="moz-txt-link-freetext" \
href="info::get_synth_symbols()">info::get_synth_symbols()</a> {
extern const bfd_target bfd_elf64_powerpc_vec;
@@ -596,10 +591,6 @@ void bfd_<a class="moz-txt-link-freetext" \
href="info::get_symbols()">info::get_symbols()</a> syms.reset(new asymbol \
*[nr_syms]);
nr_syms = bfd_canonicalize_symtab(abfd, syms.get());
-
- if (image_bfd_info)
- translate_debuginfo_syms(syms.get(), nr_syms);
-
cverb << vbfd << "bfd_canonicalize_symtab: " << dec
<< nr_syms << hex << endl;
}
diff --git a/libutil++/bfd_support.h b/libutil++/bfd_support.h
index 4f6a369..7e72d13 100644
--- a/libutil++/bfd_support.h
+++ b/libutil++/bfd_support.h
@@ -14,6 +14,7 @@
#include "utility.h"
#include "op_types.h"
#include "locate_images.h"
+#include "config.h"
#include <bfd.h>
#include <stdint.h>
@@ -72,16 +73,14 @@ private:
*/
bfd_info * image_bfd_info;
- /* To address a different issue, we discard symbols whose section
- * flag does not contain SEC_LOAD. But since this is true for symbols
- * found in debuginfo files, we must run those debuginfo symbols
- * through the function below to prevent them from being inadvertently
- * discarded. This function maps the sections from the symbols in
- * the debuginfo bfd to those of the real image bfd. Then, when
- * we later do symbol filtering, we see the sections from the real
- * bfd, which do contain SEC_LOAD in the section flag.
+#if SYNTHESIZE_SYMBOLS
+ /**
+ * This function is used only for ppc64 binaries. It uses the runtime
+ * image BFD (accessed through image_bfd_info) as needed when processing
+ * debuginfo files.
*/
void translate_debuginfo_syms(asymbol ** dbg_syms, long nr_dbg_syms);
+#endif
};
--
1.6.2.rc2
</font></pre>
</body>
</html>
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
oprofile-list mailing list
oprofile-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oprofile-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic