This file is indexed.

/usr/include/klftools/klfdebug.h is in libklatexformula3-dev 3.3.0~beta-1+b2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/***************************************************************************
 *   file klfdebug.h
 *   This file is part of the KLatexFormula Project.
 *   Copyright (C) 2011 by Philippe Faist
 *   philippe.faist at bluewin.ch
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
/* $Id: klfdebug.h 875 2014-06-15 18:18:48Z phfaist $ */

#ifndef KLFDEBUG_H
#define KLFDEBUG_H

#include <QMap>

#include <klfdefs.h>

// Note: function definitions are in klfdefs.cpp


// DEBUG UTILITIES (SOME WITH TIME PRINTING FOR TIMING OPERATIONS)

KLF_EXPORT QByteArray klfShortFuncSignature(const QByteArray& fullFuncName);
inline QByteArray klfShortFuncSignature(const char *fullFuncName)
{ return klfShortFuncSignature(QByteArray(fullFuncName)); }

KLF_EXPORT QString klfTimeOfDay(bool shortFmt = true);

#define KLF_SHORT_TIME qPrintable(klfTimeOfDay())


class KLF_EXPORT KLFDebugBlock
{
public:
  KLFDebugBlock(const QString& blockName);
  KLFDebugBlock(bool printmsg, const QString& blockName);

  virtual ~KLFDebugBlock();

protected:
  QString pBlockName;
private:
  bool pPrintMsg;
};

class KLF_EXPORT KLFDebugBlockTimer : public KLFDebugBlock
{
public:
  KLFDebugBlockTimer(const QString& blockName);
  virtual ~KLFDebugBlockTimer();
};

class KLFDebugObjectWatcherPrivate;

class KLF_EXPORT KLFDebugObjectWatcher : public QObject
{
  Q_OBJECT
public:
  static KLFDebugObjectWatcher *getWatcher();

  void registerObjectRefInfo(QObject *object, const QString& refInfo);
public slots:
  void debugObjectDestroyedFromSender() { debugObjectDestroyed(const_cast<QObject*>(sender())); }
  void debugObjectDestroyed(QObject *object);
private:

  KLFDebugObjectWatcher();
  ~KLFDebugObjectWatcher();
  static KLFDebugObjectWatcher *instance;

  KLFDebugObjectWatcherPrivate *p;
};


// needed anyways for eg. KLF_ASSERT_CONDITION
#include <QDebug>


#ifdef KLF_DEBUG


KLF_EXPORT  QDebug
/* */ __klf_dbg_hdr(QDebug dbg, const char * funcname, const char *refinstance, const char * shorttime);

template<class T>
inline const T& __klf_debug_tee(const T& expr)
{ qDebug()<<"TEE VALUE: "<<expr; return expr; }

template<class T>
inline const T& __klf_debug_tee2(const T& expr, QDebug dbg, const char *where, const char *what)
/* NOTE: No ref-inst, because we would then have to provide both KLF_DEBUG_TEE() and KLF_DEBUG_TEE_ST()
 * or similar, like klfDbgSt(). */
{ __klf_dbg_hdr(dbg, where, NULL, NULL)<<"`"<<what<<"': "<<expr; return expr; }


inline QString __klf_debug_ref_instance() { return QString(); }
#  define KLF_DEBUG_DECLARE_REF_INSTANCE( expr )			\
  protected: inline QString __klf_debug_ref_instance() const { return QString("[")+ (expr) + "]" ; }

#  define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()			\
  public: QString __klf_debug_this_ref_instance;			\
  protected: inline QString __klf_debug_ref_instance() const { return __klf_debug_this_ref_instance; }
#  define KLF_DEBUG_ASSIGN_REF_INSTANCE(object, ref_instance)	\
  (object)->__klf_debug_this_ref_instance = QString("[%1]").arg((ref_instance))
#  define KLF_DEBUG_ASSIGN_SAME_REF_INSTANCE(object)			\
  (object)->__klf_debug_this_ref_instance = __klf_debug_ref_instance();

#  define KLF_DEBUG_TIME_BLOCK(msg) KLFDebugBlockTimer __klf_debug_timer_block(QString("")+msg)
#  define KLF_DEBUG_BLOCK(msg) KLFDebugBlock __klf_debug_block(QString("")+msg)
#  define KLF_DEBUG_TEE(expr)						\
  __klf_debug_tee2(expr, qDebug(), KLF_FUNC_NAME, #expr)
#  define klfDebugf( arglist ) qDebug arglist
#  define klfDbg( streamableItems )				\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, qPrintable(__klf_debug_ref_instance()), NULL) << streamableItems
#  define klfDbgT( streamableItems )					\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, qPrintable(__klf_debug_ref_instance()), KLF_SHORT_TIME) << streamableItems
#  define klfDbgSt( streamableItems )				\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, NULL, NULL) << streamableItems
#  define klfDbgStT( streamableItems )					\
  __klf_dbg_hdr(qDebug(), KLF_FUNC_NAME, NULL, KLF_SHORT_TIME) << streamableItems

#  define KLF_DEBUG_WATCH_OBJECT( qobj )				\
  { KLFDebugObjectWatcher::getWatcher()->registerObjectRefInfo((qobj), #qobj) ; \
    connect((qobj), SIGNAL(destroyed()),				\
	    KLFDebugObjectWatcher::getWatcher(), SLOT(debugObjectDestroyedFromSender())); \
  }


#else // KLF_DEBUG


#  define KLF_DEBUG_DECLARE_REF_INSTANCE( expr )
#  define KLF_DEBUG_DECLARE_ASSIGNABLE_REF_INSTANCE()
#  define KLF_DEBUG_ASSIGN_REF_INSTANCE(object, ref_instance)
#  define KLF_DEBUG_ASSIGN_SAME_REF_INSTANCE(object)


#  define KLF_DEBUG_TIME_BLOCK(msg)
#  define KLF_DEBUG_BLOCK(msg)

#  define KLF_DEBUG_TEE(expr) (expr)

#  define klfDebugf(arglist)

#  define klfDbg( streamableItems )
#  define klfDbgT( streamableItems )
#  define klfDbgSt( streamableItems )
#  define klfDbgStT( streamableItems )

#  define KLF_DEBUG_WATCH_OBJECT( qobj )

#endif // KLF_DEBUG


KLF_EXPORT  QDebug
/* */ __klf_warning_hdr(QDebug warnstr, const char * funcname, const char * shorttime);

#define klfWarning(streamableItems) __klf_warning_hdr(qWarning(), KLF_FUNC_NAME, KLF_SHORT_TIME) << streamableItems


/* Ensure a usable __func__ symbol */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901L
#  if defined(__GNUC__) && __GNUC__ >= 2
#    define __func__ __FUNCTION__
#  else
#    define __func__ (qPrintable(QString("<in %2 line %1>").arg(__LINE__).arg(__FILE__)))
#  endif
#endif
/* The following declaration tests are inspired from "qglobal.h" in Qt 4.6.2 source code */
#ifndef KLF_FUNC_NAME
#  if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB)
#    define KLF_FUNC_NAME  (klfShortFuncSignature(__PRETTY_FUNCTION__).data())
#  elif defined(_MSC_VER)
    /* MSVC 2002 doesn't have __FUNCSIG__ */
#    if _MSC_VER <= 1300
#        define KLF_FUNC_NAME  __func__
#    else
#        define KLF_FUNC_NAME  (klfShortFuncSignature(__FUNCSIG__).data())
#    endif
#  else
#    define KLF_FUNC_NAME __func__
#  endif
#endif




#define KLF_ASSERT_CONDITION(expr, msg, failaction)		       \
  klfDbgSt("KLF_ASSERT_CONDITION(" #expr ")") ;			       \
  if ( !(expr) ) {						       \
    klfWarning(msg);						       \
    failaction;							       \
  }
#define KLF_ASSERT_CONDITION_ELSE(expr, msg, failaction)	\
  KLF_ASSERT_CONDITION(expr, msg, failaction)			\
  else
#define KLF_ASSERT_NOT_NULL(ptr, msg, failaction)	\
  KLF_ASSERT_CONDITION((ptr) != NULL, msg, failaction)



#if defined(QT_NO_DEBUG_OUTPUT)
// Qt fix: this line is needed in non-debug output mode (?)
class QVariant;
inline QDebug& operator<<(QDebug& str, const QVariant& ) { return str; }
class QModelIndex;
inline QDebug& operator<<(QDebug& str, const QModelIndex& ) { return str; }
#endif


#endif