summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2020-11-18 11:36:07 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-03-03 19:09:34 +0000
commit4b297979d25740d31241a9000e36068db112545a (patch)
treee2e40fa7922fb4a91125c73fcbae04e7a6a66f73 /includes
parent8402ea951b31e01a925ca691747d1757eaf31fcc (diff)
downloadhaskell-4b297979d25740d31241a9000e36068db112545a.tar.gz
Add -finfo-table-map which maps info tables to source positions
This new flag embeds a lookup table from the address of an info table to information about that info table. The main interface for consulting the map is the `lookupIPE` C function > InfoProvEnt * lookupIPE(StgInfoTable *info) The `InfoProvEnt` has the following structure: > typedef struct InfoProv_{ > char * table_name; > char * closure_desc; > char * ty_desc; > char * label; > char * module; > char * srcloc; > } InfoProv; > > typedef struct InfoProvEnt_ { > StgInfoTable * info; > InfoProv prov; > struct InfoProvEnt_ *link; > } InfoProvEnt; The source positions are approximated in a similar way to the source positions for DWARF debugging information. They are only approximate but in our experience provide a good enough hint about where the problem might be. It is therefore recommended to use this flag in conjunction with `-g<n>` for more accurate locations. The lookup table is also emitted into the eventlog when it is available as it is intended to be used with the `-hi` profiling mode. Using this flag will significantly increase the size of the resulting object file but only by a factor of 2-3x in our experience.
Diffstat (limited to 'includes')
-rw-r--r--includes/Rts.h1
-rw-r--r--includes/rts/EventLogFormat.h1
-rw-r--r--includes/rts/IPE.h35
3 files changed, 37 insertions, 0 deletions
diff --git a/includes/Rts.h b/includes/Rts.h
index 50a3f665de..0f96ba2eca 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -242,6 +242,7 @@ void _assertFail(const char *filename, unsigned int linenum)
#include "rts/PrimFloat.h"
#include "rts/Main.h"
#include "rts/Profiling.h"
+#include "rts/IPE.h"
#include "rts/StaticPtrTable.h"
#include "rts/Libdw.h"
#include "rts/LibdwPool.h"
diff --git a/includes/rts/EventLogFormat.h b/includes/rts/EventLogFormat.h
index 4b50adfe5b..b80a9d3a94 100644
--- a/includes/rts/EventLogFormat.h
+++ b/includes/rts/EventLogFormat.h
@@ -142,6 +142,7 @@
#define EVENT_HEAP_BIO_PROF_SAMPLE_BEGIN 166
#define EVENT_PROF_SAMPLE_COST_CENTRE 167
#define EVENT_PROF_BEGIN 168
+#define EVENT_IPE 169
#define EVENT_USER_BINARY_MSG 181
diff --git a/includes/rts/IPE.h b/includes/rts/IPE.h
new file mode 100644
index 0000000000..81a6d553d0
--- /dev/null
+++ b/includes/rts/IPE.h
@@ -0,0 +1,35 @@
+/* -----------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 2017-2018
+ *
+ * IPE API
+ *
+ * Do not #include this file directly: #include "Rts.h" instead.
+ *
+ * To understand the structure of the RTS headers, see the wiki:
+ * https://gitlab.haskell.org/ghc/ghc/wikis/commentary/source-tree/includes
+ *
+ * -------------------------------------------------------------------------- */
+
+#pragma once
+
+
+typedef struct InfoProv_{
+ char * table_name;
+ char * closure_desc;
+ char * ty_desc;
+ char * label;
+ char * module;
+ char * srcloc;
+} InfoProv;
+
+typedef struct InfoProvEnt_ {
+ StgInfoTable * info;
+ InfoProv prov;
+ struct InfoProvEnt_ *link;
+} InfoProvEnt;
+
+extern InfoProvEnt * RTS_VAR(IPE_LIST); // registered IP list
+
+void registerInfoProvList(InfoProvEnt **cc_list);
+InfoProvEnt * lookupIPE(StgInfoTable *info);