From c2fe5679e9eb8c3a18b286bbd8b85a6a17fe6858 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Mon, 7 Jan 2013 16:59:26 +0100
Subject: Avoid infinite recursion in -gdb.py printers

...when printing the pThread argument in a
cppu_threadpool::ThreadPool::waitInPool call frame.

Change-Id: I5c94485a0218be449c9dab67701a634eef3e08a1
---
 solenv/gdb/libreoffice/cppu.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/solenv/gdb/libreoffice/cppu.py b/solenv/gdb/libreoffice/cppu.py
index 1e3b25ec0dd3..8db684a74eca 100644
--- a/solenv/gdb/libreoffice/cppu.py
+++ b/solenv/gdb/libreoffice/cppu.py
@@ -143,6 +143,16 @@ class UnoTypePrinter(object):
         else:
             return "invalid %s" % self.typename
 
+class CppuThreadpoolThreadPoolPrinter(object):
+    '''Prints cppu_threadpool::ThreadPool objects (a hack to avoid infinite recursion through sal.RtlReferencePrinter when printing an rtl::Reference<cppu_threadpool::ThreadPool> whose std::list<cppu_threadpool::WaitingThread*> m_lstThreads member, via rtl::Reference<cppu_threadpool::ORequestThread> thread member, via rtl::Reference<cppu_threadpool::ThreadPool> m_aThreadPool member, has a circular reference back)'''
+
+    def __init__(self, typename, value):
+        self.typename = typename
+        self.value = value
+
+    def to_string(self):
+        return '%s@%s' % (self.typename, self.value.address)
+
 printer = None
 
 def build_pretty_printers():
@@ -156,6 +166,7 @@ def build_pretty_printers():
     printer.add('com::sun::star::uno::Reference', UnoReferencePrinter)
     printer.add('com::sun::star::uno::Sequence', UnoSequencePrinter)
     printer.add('com::sun::star::uno::Type', UnoTypePrinter)
+    printer.add('cppu_threadpool::ThreadPool', CppuThreadpoolThreadPoolPrinter)
 
 def register_pretty_printers(obj):
     printing.register_pretty_printer(printer, obj)
-- 
cgit