diff --git a/rts/IPE.c b/rts/IPE.c index 16c31b92d3dbe5230f1bc974a9109818967ce35e..ec65d6aab07de1179be1f882ef3828178066cf5f 100644 --- a/rts/IPE.c +++ b/rts/IPE.c @@ -277,3 +277,20 @@ void decompressIPEBufferListNodeIfCompressed(IpeBufferListNode *node) { } } + +#if defined(DEBUG) +void printIPE(const StgInfoTable *info) { + InfoProvEnt ipe; + if (lookupIPE(info, &ipe)) { + debugBelch("%p:\n", info); + debugBelch(" name: %s\n", ipe.prov.table_name); + debugBelch(" desc: %" PRIu32 "\n", ipe.prov.closure_desc); + debugBelch(" type: %s\n", ipe.prov.ty_desc); + debugBelch(" label: %s\n", ipe.prov.label); + debugBelch(" module: %s:%s\n", ipe.prov.unit_id, ipe.prov.module); + debugBelch(" src loc: %s:%s\n", ipe.prov.src_file, ipe.prov.src_span); + } else { + debugBelch("%p: no IPE entry\n", info); + } +} +#endif diff --git a/rts/include/rts/IPE.h b/rts/include/rts/IPE.h index d6a7355645c9976297997efddf8e3aebd510226e..7ea9519fa99c3f546c1053173a65cf16dec32372 100644 --- a/rts/include/rts/IPE.h +++ b/rts/include/rts/IPE.h @@ -97,3 +97,7 @@ void formatClosureDescIpe(const InfoProvEnt *ipe_buf, char *str_buf); // Returns true on success, initializes `out`. bool lookupIPE(const StgInfoTable *info, InfoProvEnt *out); + +#if defined(DEBUG) +void printIPE(const StgInfoTable *info); +#endif