From 3e5bfdd363740926576fb3ee031b94d17f7d955e Mon Sep 17 00:00:00 2001 From: Ben Gamari <ben@smart-cactus.org> Date: Mon, 18 Nov 2024 13:13:11 -0500 Subject: [PATCH] rts: Introduce printIPE This is a convenience utility for use in GDB. --- rts/IPE.c | 17 +++++++++++++++++ rts/include/rts/IPE.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/rts/IPE.c b/rts/IPE.c index 16c31b92d3d..ec65d6aab07 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 d6a7355645c..7ea9519fa99 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 -- GitLab