summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
Diffstat (limited to 'rts')
-rw-r--r--rts/Printer.c15
-rw-r--r--rts/RtsStartup.c6
2 files changed, 18 insertions, 3 deletions
diff --git a/rts/Printer.c b/rts/Printer.c
index 3d77e83282..9bc2984384 100644
--- a/rts/Printer.c
+++ b/rts/Printer.c
@@ -7,6 +7,8 @@
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
+#include "ghcconfig.h"
+
#include "Rts.h"
#include "rts/Bytecodes.h" /* for InstrPtr */
@@ -664,8 +666,16 @@ const char *lookupGHCName( void *addr )
disabling this for now.
*/
#ifdef USING_LIBBFD
-
-#include <bfd.h>
+# define PACKAGE 1
+# define PACKAGE_VERSION 1
+/* Those PACKAGE_* defines are workarounds for bfd:
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=14243
+ * ghc's build system filter PACKAGE_* values out specifically to avoid clashes
+ * with user's autoconf-based Cabal packages.
+ * It's a shame <bfd.h> checks for unrelated fields instead of actually used
+ * macros.
+ */
+# include <bfd.h>
/* Fairly ad-hoc piece of code that seems to filter out a lot of
* rubbish like the obj-splitting symbols
@@ -733,7 +743,6 @@ extern void DEBUG_LoadSymbols( char *name )
for( i = 0; i != number_of_symbols; ++i ) {
symbol_info info;
bfd_get_symbol_info(abfd,symbol_table[i],&info);
- /*debugBelch("\t%c\t0x%x \t%s\n",info.type,(nat)info.value,info.name); */
if (isReal(info.type, info.name)) {
num_real_syms += 1;
}
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index 98a43c0586..5e6f9fab54 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -19,6 +19,7 @@
#include "RtsFlags.h"
#include "RtsUtils.h"
#include "Prelude.h"
+#include "Printer.h" /* DEBUG_LoadSymbols */
#include "Schedule.h" /* initScheduler */
#include "Stats.h" /* initStats */
#include "STM.h" /* initSTM */
@@ -162,6 +163,11 @@ hs_init_ghc(int *argc, char **argv[], RtsConfig rts_config)
rts_config.rts_opts_enabled, rts_config.rts_opts, rts_config.rts_hs_main);
}
+#ifdef DEBUG
+ /* load debugging symbols for current binary */
+ DEBUG_LoadSymbols((*argv)[0]);
+#endif /* DEBUG */
+
/* Initialise the stats department, phase 1 */
initStats1();