2 /*--------------------------------------------------------------------*/
3 /*--- Debug (not-for-user) logging. pub_core_debuglog.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2000-2017 Julian Seward
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_DEBUGLOG_H
30 #define __PUB_CORE_DEBUGLOG_H
32 //--------------------------------------------------------------------
33 // PURPOSE: This module provides a low-level debug logging facility
34 // that works through all the twists and turns of program startup. Is
35 // is completely independent of everything, including all memory
36 // facilities, and emits the debug log on file descriptor 2 (stderr).
37 // This module is the first to be initialised at system startup.
39 // Because VG_(debugLog) does printf-style formatting, and because
40 // this module depends on NO OTHERS, this module contains Valgrind's
41 // vfprintf implementation too.
42 //--------------------------------------------------------------------
44 /* Gaaah! We don't want glibc dependencies, but there is no easy,
45 portable way to avoid using stdarg.h. */
48 #include "pub_core_basics.h" /* For definition of VG_ macro */
50 /* There are no tool-visible exports from m_debuglog, hence no header
52 /* #include "pub_tool_debuglog.h" */
57 void VG_(debugLog_startup
) ( Int level
, const HChar
* who
);
60 /* Whether %ps should escape XML metacharacters. */
61 extern void VG_(debugLog_setXml
)(Bool xml
);
64 /* Get the logging threshold level, as set by the most recent call to
65 VG_(debugLog_startup), or zero if there have been no such calls so
68 Int
VG_(debugLog_getLevel
) ( void );
71 /* Send debugging output. Nothing happens unless 'level'
72 does not exceed the logging threshold level. */
74 void VG_(debugLog
) ( Int level
, const HChar
* modulename
,
75 const HChar
* format
, ... )
76 __attribute__((format(__printf__
, 3, 4)));
79 /* A simple vprintf(). For each emitted byte, (*send_fn) is called with
80 that byte, and 'send_arg2' as its second param. */
82 UInt
VG_(debugLog_vprintf
) (
83 void (*send_fn
)(HChar
,void*),/* byte sink */
84 void* send_arg2
, /* 2nd arg for byte sink */
90 #endif // __PUB_CORE_DEBUGLOG_H
92 /*--------------------------------------------------------------------*/
93 /*--- end pub_core_debuglog.h ---*/
94 /*--------------------------------------------------------------------*/