Using the __dump functions


Subject: Using the __dump functions
From: Jesper Skov (jskov@redhat.com)
Date: Sun May 28 2000 - 03:09:08 CDT


How are people using the layout __dump debugging functions? I've been
using them interactively from GDB, but finding the necessary object
pointers got to be a pain.

So I've been using the below changes, allowing me to just type:

 (gdb) p ::__dump()

to get a dump of the (most recent) document.

I don't know if it would be OK to include the changes in the source
tree - for you to decide.

Thanks,
Jesper

Index: fl_DocLayout.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.cpp,v
retrieving revision 1.82
diff -u -5 -r1.82 fl_DocLayout.cpp
--- fl_DocLayout.cpp 2000/05/10 11:03:48 1.82
+++ fl_DocLayout.cpp 2000/05/27 20:24:59
@@ -71,10 +71,14 @@
         // TODO malloc's to occur. we are currently inside a constructor
         // TODO and are not allowed to report failure.
         
         m_pDocListener = new fl_DocListener(doc, this);
         doc->addListener(static_cast<PL_Listener *>(m_pDocListener),&m_lid);
+
+#ifdef FMT_TEST
+ m_pDocLayout = this;
+#endif
 }
 
 FL_DocLayout::~FL_DocLayout()
 {
         if (m_pPrefs)
@@ -435,10 +439,17 @@
         
         deleteEmptyColumnsAndPages();
 }
 
 #ifdef FMT_TEST
+FL_DocLayout* FL_DocLayout::m_pDocLayout = NULL;
+
+void __dump(void)
+{
+ FL_DocLayout::m_pDocLayout->__dump(stdout);
+}
+
 void FL_DocLayout::__dump(FILE * fp) const
 {
         int count = m_vecPages.getItemCount();
 
         fprintf(fp,"FL_DocLayout::dump(0x%p) contains %d pages.\n", this, m_vecPages.getItemCount());
Index: fl_DocLayout.h
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_DocLayout.h,v
retrieving revision 1.42
diff -u -5 -r1.42 fl_DocLayout.h
--- fl_DocLayout.h 2000/05/10 11:03:48 1.42
+++ fl_DocLayout.h 2000/05/27 20:24:59
@@ -141,10 +141,12 @@
         UT_Bool getSpellCheckInternet(void) const { return m_bSpellCheckInternet; }
 
         void recheckIgnoredWords();
 
 #ifdef FMT_TEST
+ static FL_DocLayout* m_pDocLayout;
+
         void __dump(FILE * fp) const;
 #endif
         
 protected:
         static void _spellCheck(UT_Timer * pTimer);



This archive was generated by hypermail 2b25 : Sun May 28 2000 - 03:09:15 CDT