src/base/Makefile
src/clients/Makefile
src/comm/Makefile
+ src/debug/Makefile
src/dns/Makefile
src/DiskIO/Makefile
src/DiskIO/AIO/Makefile
#define SQUID_INCLUDE_UNITTESTMAIN_H
#if ENABLE_DEBUG_SECTION
-#include "Debug.h"
+#include "debug/Stream.h"
#endif /* ENABLE_DEBUG_SECTION */
#include <cppunit/BriefTestProgressListener.h>
#include "auth/ntlm/Scheme.h"
#endif
-#include "Debug.h"
+#include "debug/Stream.h"
/**
* Initialize the authentication modules (if any)
#include "BandwidthBucket.h"
#include "ClientInfo.h"
#include "comm/Connection.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fde.h"
BandwidthBucket::BandwidthBucket(const int speed, const int initialLevelPercent, const double sizeLimit) :
#include "base/RegexPattern.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "globals.h"
#include "sbuf/Stream.h"
#include "CpuAffinity.h"
#include "CpuAffinityMap.h"
#include "CpuAffinitySet.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "SquidConfig.h"
#include "tools.h"
#include "base/TextException.h"
#include "CpuAffinityMap.h"
#include "CpuAffinitySet.h"
-#include "Debug.h"
+#include "debug/Stream.h"
bool
CpuAffinityMap::add(const std::vector<int> &aProcesses, const std::vector<int> &aCores)
#include "squid.h"
#include "base/TextException.h"
#include "CpuAffinitySet.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "util.h"
#include <cerrno>
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "DiskIO/AIO/AIODiskFile.h"
#include "DiskIO/AIO/AIODiskIOStrategy.h"
#include "DiskIO/IORequestor.h"
#include "squid.h"
#include "BlockingFile.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "defines.h"
#include "DiskIO/IORequestor.h"
#include "DiskIO/ReadRequest.h"
/* DEBUG: section 47 Store Directory Routines */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "DiskIO/IORequestor.h"
#include "DiskIO/Mmapped/MmappedFile.h"
#include "DiskIO/ReadRequest.h"
*/
#include "squid.h"
+#include "base/Raw.h"
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
#include "squid.h"
#include "AsyncEngine.h"
#include "base/AsyncCallQueue.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "EventLoop.h"
#include "fatal.h"
#include "SquidTime.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "FadingCounter.h"
#include "SquidTime.h"
#include "squid.h"
#include "base/Packable.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "enums.h"
#include "HttpHdrContRange.h"
#include "HttpHeaderTools.h"
#include "squid.h"
#include "base/CharacterSet.h"
#include "base/EnumIterator.h"
+#include "base/Raw.h"
#include "base64.h"
#include "globals.h"
#include "http/ContentLengthInterpreter.h"
#include "squid.h"
#include "base/File.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "fs_io.h"
#include "Instance.h"
#include "parser/Tokenizer.h"
*/
#include "squid.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "LoadableModule.h"
#include "LoadableModules.h"
#include "wordlist.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "LogTags.h"
void
LoadableModules.cc \
LoadableModules.h
-SUBDIRS = mem base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp
-DIST_SUBDIRS = mem base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp
+SUBDIRS = mem debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp
+DIST_SUBDIRS = mem debug base anyp helper dns ftp parser comm error eui acl format clients sbuf servers fs repl store DiskIO proxyp
if ENABLE_AUTH
SUBDIRS += auth
CpuAffinityMap.h \
CpuAffinitySet.cc \
CpuAffinitySet.h \
- Debug.h \
- DebugMessages.h \
Downloader.cc \
Downloader.h \
ETag.cc \
client_side_reply.h \
client_side_request.cc \
client_side_request.h \
- debug.cc \
defines.h \
dlink.cc \
dlink.h \
log/liblog.la \
format/libformat.la \
sbuf/libsbuf.la \
+ debug/libdebug.la \
$(XTRA_OBJS) \
$(REPL_OBJS) \
$(NETTLELIB) \
String.cc \
cbdata.cc \
cbdata.h \
- debug.cc \
dlink.cc \
dlink.h \
tests/stub_fd.cc \
fs/libfs.la \
ipc/libipc.la \
mgr/libmgr.la \
+ debug/libdebug.la \
$(XTRA_OBJS) \
$(REPL_OBJS) \
$(NETTLELIB) \
client_side.h \
client_side_reply.cc \
client_side_request.cc \
- debug.cc \
dlink.cc \
dlink.h \
errorpage.cc \
base/libbase.la \
mgr/libmgr.la \
sbuf/libsbuf.la \
+ debug/libdebug.la \
store/libstore.la \
$(SNMP_LIBS) \
$(top_builddir)/lib/libmisccontainers.la \
check_PROGRAMS += tests/testHttp1Parser
tests_testHttp1Parser_SOURCES = \
- Debug.h \
tests/stub_HelperChildConfig.cc \
tests/testHttp1Parser.cc \
tests/testHttp1Parser.h \
client_side.h \
client_side_reply.cc \
client_side_request.cc \
- debug.cc \
dlink.cc \
dlink.h \
errorpage.cc \
format/libformat.la \
store/libstore.la \
sbuf/libsbuf.la \
+ debug/libdebug.la \
$(REPL_OBJS) \
$(ADAPTATION_LIBS) \
$(ESI_LIBS) \
client_side.h \
client_side_reply.cc \
client_side_request.cc \
- debug.cc \
dlink.cc \
dlink.h \
errorpage.cc \
mem/libmem.la \
store/libstore.la \
sbuf/libsbuf.la \
+ debug/libdebug.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
#include "cache_cf.h"
#include "compat/strtoll.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "Parsing.h"
#include "sbuf/Stream.h"
#include "CachePeer.h"
#include "comm/Connection.h"
#include "comm/ConnOpener.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fd.h"
#include "FwdState.h"
#include "globals.h"
#include "squid.h"
#include "anyp/PortCfg.h"
#include "client_side.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/Stream.h"
#include "Pipeline.h"
#define SQUID_STRING_H
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include <ostream>
/* DEBUG: section 20 Swap Dir base object */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "defines.h"
#include "Store.h"
#include "StoreIOState.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "defines.h"
#include "StoreMeta.h"
#include "StoreMetaUnpacker.h"
/* Inspired by previous work by Romeo Anghelache & Eric Stern. */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "protos.h"
#include "SquidConfig.h"
#include "squid.h"
#include "cache_cf.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "XactionInitiator.h"
#include <map>
#include "anyp/PortCfg.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "globals.h"
#include "sbuf/List.h"
#include "adaptation/ServiceGroups.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
void
ACLAdaptationServiceData::parse()
#include "acl/Checklist.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "format/Format.h"
#include "sbuf/Algorithms.h"
#include "acl/Arp.h"
#include "acl/FilledChecklist.h"
#include "cache_cf.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "eui/Eui48.h"
#include "globals.h"
#include "ip/Address.h"
#include "base/EnumIterator.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/Stream.h"
#include "wordlist.h"
#include "squid.h"
#include "acl/BoolOps.h"
#include "acl/Checklist.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/SBuf.h"
/* Acl::NotNode */
#include "acl/Checklist.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "wordlist.h"
ACLCertificateData::ACLCertificateData(Ssl::GETX509ATTRIBUTE *sslStrategy, const char *attrs, bool optionalAttr) : validAttributesStr(attrs), attributeIsOptional(optionalAttr), attribute (NULL), values (), sslAttributeCall (sslStrategy)
#include "squid.h"
#include "acl/Checklist.h"
#include "acl/Tree.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include <algorithm>
#include "squid.h"
#include "acl/ConnMark.h"
#include "acl/FilledChecklist.h"
+#include "base/IoManip.h"
#include "client_side.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/Stream.h"
#include "sbuf/Stream.h"
#include "squid.h"
#include "acl/ConnectionsEncrypted.h"
#include "acl/FilledChecklist.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "SquidConfig.h"
#include "anyp/Uri.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "util.h"
template<class T>
#include "acl/Eui64.h"
#include "acl/FilledChecklist.h"
#include "cache_cf.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "eui/Eui64.h"
#include "globals.h"
#include "ip/Address.h"
#include "client_side.h"
#include "comm/Connection.h"
#include "comm/forward.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "ExternalACLEntry.h"
#include "http/Stream.h"
#include "HttpReply.h"
#include "base/RegexPattern.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "HttpHeaderTools.h"
#include "sbuf/SBuf.h"
#include "sbuf/StringConvert.h"
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "acl/HttpStatus.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "HttpReply.h"
#include <climits>
#include "acl/InnerNode.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include <algorithm>
#include "acl/IntRange.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "Parsing.h"
#include "acl/Ip.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ip/tools.h"
#include "MemBuf.h"
#include "wordlist.h"
#include "acl/FilledChecklist.h"
#include "acl/MaxConnection.h"
#include "client_db.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "SquidConfig.h"
ACLMaxConnection::ACLMaxConnection (char const *theClass) : class_ (theClass), limit(-1)
#include "acl/NoteData.h"
#include "acl/StringData.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/StringConvert.h"
#include "wordlist.h"
#include "squid.h"
#include "acl/Options.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/Stream.h"
#include <iostream>
#include "acl/Checklist.h"
#include "acl/ProtocolData.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "wordlist.h"
ACLProtocolData::~ACLProtocolData()
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "acl/Random.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Parsing.h"
#include "wordlist.h"
#include "base/RegexPattern.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/Algorithms.h"
#include "sbuf/List.h"
#include "sbuf/Stream.h"
#include "acl/SquidErrorData.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "error/Error.h"
#include "fatal.h"
#include "wordlist.h"
#include "acl/Checklist.h"
#include "acl/StringData.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
void
ACLStringData::insert(const char *value)
#include "acl/TimeData.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "wordlist.h"
#define ACL_SUNDAY 0x01
#include "acl/FilledChecklist.h"
#include "acl/TransactionInitiator.h"
#include "cache_cf.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "HttpRequest.h"
#include "MasterXaction.h"
#include "SquidConfig.h"
#include "acl/Options.h"
#include "acl/UserData.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "sbuf/Algorithms.h"
#include "util.h"
#include "adaptation/Service.h"
#include "adaptation/ServiceGroups.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
int Adaptation::AccessRule::LastId = 0;
#include "adaptation/ServiceGroups.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "globals.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "adaptation/Config.h"
#include "adaptation/History.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "SquidTime.h"
#include "adaptation/ServiceConfig.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "ip/tools.h"
#include <set>
#include "adaptation/ServiceFilter.h"
#include "adaptation/ServiceGroups.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "StrList.h"
#include "wordlist.h"
#include "adaptation/ecap/XactionRep.h"
#include "AsyncEngine.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "EventLoop.h"
#include <libecap/adapter/service.h>
#include "squid.h"
#include "adaptation/icap/Client.h"
-#include "Debug.h"
+#include "debug/Stream.h"
void Adaptation::Icap::InitModule()
{
#include "squid.h"
#include "adaptation/icap/History.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "SquidTime.h"
#include "base/TextException.h"
#include "comm/Connection.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fde.h"
#include "globals.h"
#include "HttpReply.h"
#include "squid.h"
#include "anyp/Uri.h"
+#include "base/Raw.h"
#include "globals.h"
#include "HttpRequest.h"
#include "parser/Tokenizer.h"
#include "auth/AclMaxUserIp.h"
#include "auth/UserRequest.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Parsing.h"
#include "wordlist.h"
#include "auth/Config.h"
#include "auth/CredentialsCache.h"
#include "base/RunnersRegistry.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "event.h"
namespace Auth {
#include "auth/UserRequest.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "errorpage.h"
#include "format/Format.h"
#include "globals.h"
#include "squid.h"
#include "auth/basic/Config.h"
#include "auth/basic/Scheme.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "helper.h"
Auth::Scheme::Pointer Auth::Basic::Scheme::_instance = NULL;
#include "auth/basic/User.h"
#include "auth/Config.h"
#include "auth/CredentialsCache.h"
-#include "Debug.h"
+#include "debug/Stream.h"
Auth::Basic::User::User(Auth::SchemeConfig *aConfig, const char *aRequestRealm) :
Auth::User(aConfig, aRequestRealm),
#include "auth/basic/UserRequest.h"
#include "auth/QueueNode.h"
#include "auth/State.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "format/Format.h"
#include "helper.h"
#include "helper/Reply.h"
#include "squid.h"
#include "auth/digest/Config.h"
#include "auth/digest/Scheme.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "helper.h"
#include "auth/CredentialsCache.h"
#include "auth/digest/Config.h"
#include "auth/digest/User.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "dlink.h"
Auth::Digest::User::User(Auth::SchemeConfig *aConfig, const char *aRequestRealm) :
#include "squid.h"
#include "auth/negotiate/Config.h"
#include "auth/negotiate/Scheme.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "helper.h"
Auth::Scheme::Pointer Auth::Negotiate::Scheme::_instance = NULL;
#include "auth/CredentialsCache.h"
#include "auth/negotiate/User.h"
#include "auth/SchemeConfig.h"
-#include "Debug.h"
+#include "debug/Stream.h"
Auth::Negotiate::User::User(Auth::SchemeConfig *aConfig, const char *aRequestRealm) :
Auth::User(aConfig, aRequestRealm)
#include "squid.h"
#include "auth/ntlm/Config.h"
#include "auth/ntlm/Scheme.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "helper.h"
Auth::Scheme::Pointer Auth::Ntlm::Scheme::_instance = NULL;
#include "auth/CredentialsCache.h"
#include "auth/ntlm/User.h"
#include "auth/SchemeConfig.h"
-#include "Debug.h"
+#include "debug/Stream.h"
Auth::Ntlm::User::User(Auth::SchemeConfig *aConfig, const char *aRequestRealm) :
Auth::User(aConfig, aRequestRealm)
#include "base/AsyncCallQueue.h"
#include "base/CodeContext.h"
#include "cbdata.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include <ostream>
InstanceIdDefinitions(AsyncCall, "call");
#include "squid.h"
#include "base/AsyncCall.h"
#include "base/AsyncCallQueue.h"
-#include "Debug.h"
+#include "debug/Stream.h"
AsyncCallQueue *AsyncCallQueue::TheInstance = 0;
#include "base/AsyncJob.h"
#include "base/CbcPointer.h"
-#include "Debug.h"
+#include "debug/Stream.h"
/**
\ingroup AsyncJobAPI
#include "base/TextException.h"
#include "cbdata.h"
-#include "Debug.h"
+#include "debug/Stream.h"
/**
\ingroup CBDATAAPI
#include "squid.h"
#include "base/CodeContext.h"
-#include "Debug.h"
+#include "debug/Stream.h"
/// represents a being-forgotten CodeContext (while it may be being destroyed)
class FadingCodeContext: public CodeContext
#include "squid.h"
#include "base/File.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/Stream.h"
#include "tools.h"
#include "xusleep.h"
--- /dev/null
+/*
+ * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "base/IoManip.h"
+#include "debug/Stream.h"
+
+#include <algorithm>
+
+void
+PrintHex(std::ostream &os, const char * const data, const size_t n)
+{
+ if (!n)
+ return;
+ assert(data);
+
+ const auto savedFill = os.fill('0');
+ const auto savedFlags = os.flags(); // std::ios_base::fmtflags
+ os << std::hex;
+ std::for_each(data, data + n,
+ [&os](const char &c) { os << std::setw(2) << static_cast<uint8_t>(c); });
+ os.flags(savedFlags);
+ os.fill(savedFill);
+}
+
--- /dev/null
+/*
+ * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef SQUID_SRC_BASE_IO_MANIP_H
+#define SQUID_SRC_BASE_IO_MANIP_H
+
+#include <iostream>
+#include <iomanip>
+
+/// debugs objects pointed by possibly nil pointers: label=object
+template <class Pointer>
+class RawPointerT {
+public:
+ RawPointerT(const char *aLabel, const Pointer &aPtr):
+ label(aLabel), ptr(aPtr) {}
+ const char *label; /// the name or description of the being-debugged object
+ const Pointer &ptr; /// a possibly nil pointer to the being-debugged object
+};
+
+/// convenience wrapper for creating RawPointerT<> objects
+template <class Pointer>
+inline RawPointerT<Pointer>
+RawPointer(const char *label, const Pointer &ptr)
+{
+ return RawPointerT<Pointer>(label, ptr);
+}
+
+/// prints RawPointerT<>, dereferencing the io_manip pointer if possible
+template <class Pointer>
+inline std::ostream &
+operator <<(std::ostream &os, const RawPointerT<Pointer> &pd)
+{
+ os << pd.label << '=';
+ if (pd.ptr)
+ os << *pd.ptr;
+ else
+ os << "[nil]";
+ return os;
+}
+
+/// std::ostream manipulator to print integers as hex numbers prefixed by 0x
+template <class Integer>
+class AsHex
+{
+public:
+ explicit AsHex(const Integer n): io_manip(n) {}
+ Integer io_manip; ///< the integer to print
+};
+
+template <class Integer>
+inline std::ostream &
+operator <<(std::ostream &os, const AsHex<Integer> number)
+{
+ const auto oldFlags = os.flags();
+ os << std::hex << std::showbase << number.io_manip;
+ os.setf(oldFlags);
+ return os;
+}
+
+/// a helper to ease AsHex object creation
+template <class Integer>
+inline AsHex<Integer> asHex(const Integer n) { return AsHex<Integer>(n); }
+
+/// Prints the first n data bytes using hex notation. Does nothing if n is 0.
+void PrintHex(std::ostream &, const char *data, size_t n);
+
+#endif /* SQUID_SRC_BASE_IO_MANIP_H */
+
Here.h \
InstanceId.cc \
InstanceId.h \
+ IoManip.cc \
+ IoManip.h \
JobWait.cc \
JobWait.h \
Lock.h \
Packable.h \
PackableStream.h \
Range.h \
+ Raw.cc \
+ Raw.h \
RefCount.h \
RegexPattern.cc \
RegexPattern.h \
--- /dev/null
+/*
+ * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "base/IoManip.h"
+#include "base/Raw.h"
+#include "debug/Stream.h"
+
+#include <iostream>
+
+std::ostream &
+Raw::print(std::ostream &os) const
+{
+ if (label_)
+ os << ' ' << label_ << '[' << size_ << ']';
+
+ if (!size_)
+ return os;
+
+ // finalize debugging level if no level was set explicitly via minLevel()
+ const int finalLevel = (level >= 0) ? level :
+ (size_ > 40 ? DBG_DATA : Debug::SectionLevel());
+ if (finalLevel <= Debug::SectionLevel()) {
+ if (label_)
+ os << '=';
+ else if (useGap_)
+ os << ' ';
+ if (data_) {
+ if (useHex_)
+ PrintHex(os, data_, size_);
+ else
+ os.write(data_, size_);
+ } else {
+ os << "[null]";
+ }
+ }
+
+ return os;
+}
+
--- /dev/null
+/*
+ * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+/* DEBUG: section 00 Debug Routines */
+
+#ifndef SQUID_SRC_BASE_RAW_H
+#define SQUID_SRC_BASE_RAW_H
+
+#include <iosfwd>
+
+/// Prints raw and/or non-terminated data safely, efficiently, and beautifully.
+/// Allows raw data debugging in debugs() statements with low debugging levels
+/// by printing only if higher section debugging levels are configured:
+/// debugs(11, DBG_IMPORTANT, "always printed" << Raw(may be printed...));
+class Raw
+{
+public:
+ Raw(const char *label, const char *data, const size_t size):
+ level(-1), label_(label), data_(data), size_(size), useHex_(false), useGap_(true) {}
+
+ /// limit data printing to at least the given debugging level
+ Raw &minLevel(const int aLevel) { level = aLevel; return *this; }
+
+ /// print data using two hex digits per byte (decoder: xxd -r -p)
+ Raw &hex() { useHex_ = true; return *this; }
+
+ Raw &gap(bool useGap = true) { useGap_ = useGap; return *this; }
+
+ /// If debugging is prohibited by the current debugs() or section level,
+ /// prints nothing. Otherwise, dumps data using one of these formats:
+ /// " label[size]=data" if label was set and data size is positive
+ /// " label[0]" if label was set and data size is zero
+ /// " data" if label was not set and data size is positive
+ /// "" (i.e., prints nothing) if label was not set and data size is zero
+ std::ostream &print(std::ostream &os) const;
+
+ /// Minimum section debugging level necessary for printing. By default,
+ /// small strings are always printed while large strings are only printed
+ /// if DBG_DATA debugging level is enabled.
+ int level;
+
+private:
+ void printHex(std::ostream &os) const;
+
+ const char *label_; ///< optional data name or ID; triggers size printing
+ const char *data_; ///< raw data to be printed
+ size_t size_; ///< data length
+ bool useHex_; ///< whether hex() has been called
+ bool useGap_; ///< whether to print leading space if label is missing
+};
+
+inline std::ostream &
+operator <<(std::ostream &os, const Raw &raw)
+{
+ raw.print(os);
+ return os;
+}
+
+#endif /* SQUID_SRC_BASE_RAW_H */
+
#include "squid.h"
#include "base/RegexPattern.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/Stream.h"
#include <iostream>
#include "squid.h"
#include "base/RunnersRegistry.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include <set>
/// a collection of unique runners, in no particular order
#define SQUID_YESNONONE_H_
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
// TODO: generalize / template to non-boolean option types
// and make YesNoNone the boolean instance of the template
class CodeContext;
class ScopedId;
class BadOptionalAccess;
+class Raw;
class RegexPattern;
template <typename Value> class Optional;
#include "ConfigOption.h"
#include "ConfigParser.h"
#include "CpuAffinityMap.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "DiskIO/DiskIOModule.h"
#include "eui/Config.h"
#include "ExternalACL.h"
#include "base/TextException.h"
#include "CacheManager.h"
#include "comm/Connection.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "error/ExceptionErrorDetail.h"
#include "errorpage.h"
#include "fde.h"
#include "comm/TcpAcceptor.h"
#include "comm/Write.h"
#include "CommCalls.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "error/ExceptionErrorDetail.h"
#include "errorpage.h"
#include "fd.h"
*/
#include "squid.h"
+#include "base/Raw.h"
#include "CachePeer.h"
#include "clients/HttpTunneler.h"
#include "comm/Read.h"
#include "comm/Read.h"
#include "comm_internal.h"
#include "CommCalls.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fd.h"
#include "fde.h"
#include "sbuf/SBuf.h"
#include "squid.h"
#include "comm/Tcp.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#if HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
--- /dev/null
+## Copyright (C) 1996-2022 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
+
+include $(top_srcdir)/src/Common.am
+include $(top_srcdir)/src/TestHeaders.am
+
+noinst_LTLIBRARIES = libdebug.la
+
+libdebug_la_SOURCES = \
+ debug.cc \
+ Messages.h \
+ Stream.h
+
#ifndef SQUID_DEBUG_MESSAGES_H
#define SQUID_DEBUG_MESSAGES_H
-#include "Debug.h"
+#include "debug/Stream.h"
#include "SquidConfig.h"
#include <array>
/* DEBUG: section 00 Debug Routines */
-#ifndef SQUID_DEBUG_H
-#define SQUID_DEBUG_H
+#ifndef SQUID_SRC_DEBUG_STREAM_H
+#define SQUID_SRC_DEBUG_STREAM_H
#include "base/Here.h"
// XXX should be mem/forward.h once it removes dependencies on typedefs.h
/* Legacy debug function definitions */
void _db_rotate_log(void);
-/// Prints raw and/or non-terminated data safely, efficiently, and beautifully.
-/// Allows raw data debugging in debugs() statements with low debugging levels
-/// by printing only if higher section debugging levels are configured:
-/// debugs(11, DBG_IMPORTANT, "always printed" << Raw(may be printed...));
-class Raw
-{
-public:
- Raw(const char *label, const char *data, const size_t size):
- level(-1), label_(label), data_(data), size_(size), useHex_(false), useGap_(true) {}
-
- /// limit data printing to at least the given debugging level
- Raw &minLevel(const int aLevel) { level = aLevel; return *this; }
-
- /// print data using two hex digits per byte (decoder: xxd -r -p)
- Raw &hex() { useHex_ = true; return *this; }
-
- Raw &gap(bool useGap = true) { useGap_ = useGap; return *this; }
-
- /// If debugging is prohibited by the current debugs() or section level,
- /// prints nothing. Otherwise, dumps data using one of these formats:
- /// " label[size]=data" if label was set and data size is positive
- /// " label[0]" if label was set and data size is zero
- /// " data" if label was not set and data size is positive
- /// "" (i.e., prints nothing) if label was not set and data size is zero
- std::ostream &print(std::ostream &os) const;
-
- /// Minimum section debugging level necessary for printing. By default,
- /// small strings are always printed while large strings are only printed
- /// if DBG_DATA debugging level is enabled.
- int level;
-
-private:
- void printHex(std::ostream &os) const;
-
- const char *label_; ///< optional data name or ID; triggers size printing
- const char *data_; ///< raw data to be printed
- size_t size_; ///< data length
- bool useHex_; ///< whether hex() has been called
- bool useGap_; ///< whether to print leading space if label is missing
-};
-
-inline
-std::ostream &operator <<(std::ostream &os, const Raw &raw)
-{
- return raw.print(os);
-}
-
-/// debugs objects pointed by possibly nil pointers: label=object
-template <class Pointer>
-class RawPointerT {
-public:
- RawPointerT(const char *aLabel, const Pointer &aPtr):
- label(aLabel), ptr(aPtr) {}
- const char *label; /// the name or description of the being-debugged object
- const Pointer &ptr; /// a possibly nil pointer to the being-debugged object
-};
-
-/// convenience wrapper for creating RawPointerT<> objects
-template <class Pointer>
-inline RawPointerT<Pointer>
-RawPointer(const char *label, const Pointer &ptr)
-{
- return RawPointerT<Pointer>(label, ptr);
-}
-
-/// prints RawPointerT<>, dereferencing the raw pointer if possible
-template <class Pointer>
-inline std::ostream &
-operator <<(std::ostream &os, const RawPointerT<Pointer> &pd)
-{
- os << pd.label << '=';
- if (pd.ptr)
- return os << *pd.ptr;
- else
- return os << "[nil]";
-}
-
-/// std::ostream manipulator to print integers as hex numbers prefixed by 0x
-template <class Integer>
-class AsHex
-{
-public:
- explicit AsHex(const Integer n): raw(n) {}
- Integer raw; ///< the integer to print
-};
-
-template <class Integer>
-inline std::ostream &
-operator <<(std::ostream &os, const AsHex<Integer> number)
-{
- const auto oldFlags = os.flags();
- os << std::hex << std::showbase << number.raw;
- os.setf(oldFlags);
- return os;
-}
-
-/// a helper to ease AsHex object creation
-template <class Integer>
-inline AsHex<Integer> asHex(const Integer n) { return AsHex<Integer>(n); }
-
-/// Prints the first n data bytes using hex notation. Does nothing if n is 0.
-void PrintHex(std::ostream &, const char *data, size_t n);
-
-#endif /* SQUID_DEBUG_H */
+#endif /* SQUID_SRC_DEBUG_STREAM_H */
#include "squid.h"
#include "base/Optional.h"
#include "base/TextException.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Stream.h"
#include "fd.h"
#include "ipc/Kids.h"
#include "SquidTime.h"
int Debug::Levels[MAX_DEBUG_SECTIONS];
char *Debug::cache_log = NULL;
int Debug::rotateNumber = -1;
-DebugMessages TheDebugMessages;
/// a counter related to the number of debugs() calls
using DebugRecordCount = uint64_t;
return s;
}
-void
-PrintHex(std::ostream &os, const char *data, const size_t n)
-{
- if (!n)
- return;
- assert(data);
-
- const auto savedFill = os.fill('0');
- const auto savedFlags = os.flags(); // std::ios_base::fmtflags
- os << std::hex;
- std::for_each(data, data + n,
- [&os](const char &c) { os << std::setw(2) << static_cast<uint8_t>(c); });
- os.flags(savedFlags);
- os.fill(savedFill);
-}
-
-std::ostream &
-Raw::print(std::ostream &os) const
-{
- if (label_)
- os << ' ' << label_ << '[' << size_ << ']';
-
- if (!size_)
- return os;
-
- // finalize debugging level if no level was set explicitly via minLevel()
- const int finalLevel = (level >= 0) ? level :
- (size_ > 40 ? DBG_DATA : Debug::SectionLevel());
- if (finalLevel <= Debug::SectionLevel()) {
- if (label_)
- os << '=';
- else if (useGap_)
- os << ' ';
- if (data_) {
- if (useHex_)
- PrintHex(os, data_, size_);
- else
- os.write(data_, size_);
- } else {
- os << "[null]";
- }
- }
-
- return os;
-}
-
#include "comm/Loops.h"
#include "comm/Read.h"
#include "comm/Write.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "dlink.h"
#include "dns/forward.h"
#include "dns/rfc3596.h"
/* DEBUG: section 04 Error Management */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "error/Error.h"
void
#define SQUID_ESIELEMENT_H
#include "base/RefCount.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "esi/Segment.h"
#include <vector>
/* DEBUG: section 86 ESI processing */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "esi/Esi.h"
#include "esi/Expression.h"
/* DEBUG: section 86 ESI processing */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "esi/Parser.h"
#include "fatal.h"
/* DEBUG: section 86 ESI processing */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "esi/Segment.h"
#include "SquidString.h"
/* DEBUG: section 86 ESI processing */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
/* MS Visual Studio Projects are monolithic, so we need the following
#if USE_SQUID_EUI
-#include "Debug.h"
+#include "debug/Stream.h"
#include "eui/Eui48.h"
#include "globals.h"
#include "ip/Address.h"
#if USE_SQUID_EUI
#include "compat/eui64_aton.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "eui/Eui64.h"
#include "globals.h"
#include "ip/Address.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "globals.h"
#include "store/Disks.h"
#include "squid.h"
#include "comm/Loops.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "fd.h"
#include "fde.h"
#include "squid.h"
#include "comm/Read.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
/* DEBUG: section 08 Swap File Bitmap */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "FileMap.h"
/* Number of bits in a long */
#include "squid.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "format/Config.h"
#include <list>
#include "squid.h"
#include "base/AsyncJobCalls.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fs/rock/RockHeaderUpdater.h"
#include "fs/rock/RockIoState.h"
#include "mime_header.h"
#include "squid.h"
#include "base/AsyncJobCalls.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "fs/rock/RockDbCell.h"
#include "fs/rock/RockRebuild.h"
#include "fs/rock/RockSwapDir.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "md5.h"
#include "StoreSwapLogData.h"
#include "swap_log_op.h"
#include "squid.h"
#include "base/AsyncCbdataCalls.h"
#include "base/Packable.h"
+#include "base/Raw.h"
#include "comm.h"
#include "comm/Connection.h"
#include "comm/Read.h"
#include "comm/Write.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "fd.h"
#include "fde.h"
#include "format/Quoting.h"
#include "squid.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "helper/ChildConfig.h"
#include "Parsing.h"
#include "squid.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "helper.h"
#include "helper/Reply.h"
#include "rfc1738.h"
#include "comm/Loops.h"
#include "comm/UdpOpenDialer.h"
#include "compat/xalloc.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "globals.h"
#include "htcp.h"
#include "http.h"
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/AsyncJobCalls.h"
+#include "base/Raw.h"
#include "base/TextException.h"
#include "base64.h"
#include "CachePeer.h"
#include "squid.h"
#include "base/CharacterSet.h"
-#include "Debug.h"
+#include "base/Raw.h"
+#include "debug/Stream.h"
#include "http/ContentLengthInterpreter.h"
#include "http/one/Parser.h"
#include "HttpHeaderTools.h"
/* DEBUG: section 74 HTTP Message */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/ContentLengthInterpreter.h"
#include "http/Message.h"
#include "http/one/Parser.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/StatusCode.h"
const char *
#include "squid.h"
#include "base/Packable.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/ResponseParser.h"
#include "http/StatusLine.h"
#include "parser/forward.h"
#include "squid.h"
#include "base/CharacterSet.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/Parser.h"
#include "mime_header.h"
#include "parser/Tokenizer.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/RequestParser.h"
#include "http/ProtocolVersion.h"
#include "parser/Tokenizer.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "base/Raw.h"
+#include "debug/Stream.h"
#include "http/one/ResponseParser.h"
#include "http/ProtocolVersion.h"
#include "parser/Tokenizer.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/TeChunkedParser.h"
#include "http/one/Tokenizer.h"
#include "http/ProtocolVersion.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/Parser.h"
#include "http/one/Tokenizer.h"
#include "parser/Tokenizer.h"
/* DEBUG: section 37 ICMP Routines */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Icmp.h"
#include "SquidTime.h"
#if USE_ICMP
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Icmp4.h"
#include "IcmpPinger.h"
#include "SquidTime.h"
#if USE_ICMP
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Icmp6.h"
#include "IcmpPinger.h"
#include "SquidTime.h"
#if USE_ICMP
-#include "Debug.h"
+#include "debug/Stream.h"
#include "Icmp4.h"
#include "Icmp6.h"
#include "IcmpPinger.h"
# pinger depends on these but install/dist is done elsewhere.
COPIED_SOURCE= \
- debug.cc \
globals.cc \
SquidConfig.cc \
tests/stub_fd.cc \
pinger_LDADD=\
libicmpcore.la \
$(top_builddir)/src/ip/libip.la \
+ $(top_builddir)/src/debug/libdebug.la \
$(top_builddir)/src/base/libbase.la \
$(COMPAT_LIB) \
$(SSLLIB) \
## files we need to pull in from other locations
## copied like this to avoid subdir-objects collisions on 'make clean'
-debug.cc: $(top_srcdir)/src/debug.cc
- cp $(top_srcdir)/src/debug.cc $@
-
globals.cc: $(top_srcdir)/src/globals.h
cp $(top_builddir)/src/globals.cc $@
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "SquidTime.h"
#if USE_ICMP
/* DEBUG: section 14 IP Storage and Handling */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ip/Address.h"
#include "ip/tools.h"
#include "util.h"
*/
#include "squid.h"
-
+#include "base/IoManip.h"
#include "ConfigParser.h"
#include "ip/NfMarkConfig.h"
#include "parser/Tokenizer.h"
#include "squid.h"
#include "acl/Gadgets.h"
+#include "base/IoManip.h"
#include "cache_cf.h"
#include "comm/Connection.h"
#include "compat/cmsg.h"
/* DEBUG: section 21 Misc Functions */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ip/Address.h"
#include "ip/tools.h"
/* DEBUG: section 54 Interprocess Communication */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/FdNotes.h"
const char *
#ifndef SQUID_IPC_STORE_MAP_H
#define SQUID_IPC_STORE_MAP_H
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/mem/FlexibleArray.h"
#include "ipc/mem/Pointer.h"
#include "ipc/ReadWriteLock.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "ipc/Queue.h"
#define SQUID_IPC_QUEUE_H
#include "base/InstanceId.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/mem/FlexibleArray.h"
#include "ipc/mem/Pointer.h"
#include "util.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/RequestId.h"
#include <iostream>
/* DEBUG: section 54 Interprocess Communication */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "ipc/Port.h"
#include "ipc/StrandCoord.h"
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/mem/Page.h"
#include "ipc/mem/PageStack.h"
#include "squid.h"
#include "base/TextException.h"
#include "compat/shm.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "ipc/mem/Segment.h"
#include "sbuf/SBuf.h"
#include "squid.h"
#include "CacheManager.h"
#include "cbdata.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "dlink.h"
#include "dns/LookupDetails.h"
#include "dns/rfc3596.h"
#include "squid.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "log/Config.h"
Log::LogConfig Log::TheConfig;
/* DEBUG: section 50 Log file handling */
#include "squid.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "fatal.h"
#include "fde.h"
#include "log/File.h"
#include "acl/Gadgets.h"
#include "base/TextException.h"
#include "cache_cf.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "log/Config.h"
#include "log/File.h"
#include "log/FormattedLog.h"
/* DEBUG: section 50 Log file handling */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#if HAVE_SYSLOG
#include "CommandLine.h"
#include "ConfigParser.h"
#include "CpuAffinity.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "DiskIO/DiskIOModule.h"
#include "dns/forward.h"
#include "errorpage.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/TypedMsgHdr.h"
#include "mgr/IntParam.h"
/* DEBUG: section 25 MIME Parsing and Internal Icons */
#include "squid.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "fde.h"
#include "fs_io.h"
#include "globals.h"
/* DEBUG: section 25 MiME Header Parsing */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "mime_header.h"
#include "sbuf/SBuf.h"
#include "squid.h"
#include "comm/Connection.h"
-#include "Debug.h"
+#include "debug/Stream.h"
// XXX: for icpIncomingConn - need to pass it as a generic parameter.
#include "ICP.h"
#include "ipcache.h"
#include "CachePeer.h"
#include "comm/Connection.h"
#include "comm/ConnOpener.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "event.h"
#include "FwdState.h"
#include "globals.h"
/* DEBUG: section 24 SBuf */
#include "squid.h"
+#include "base/Raw.h"
#include "ip/Address.h"
#include "parser/BinaryTokenizer.h"
/* DEBUG: section 24 SBuf */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "parser/forward.h"
#include "parser/Tokenizer.h"
#include "sbuf/Stream.h"
#endif
#include "base64.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "peer_proxy_negotiate_auth.h"
#ifdef __cplusplus
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/DetailedStats.h"
#include "sbuf/MemBlob.h"
#include "squid.h"
#include "base/CharacterSet.h"
+#include "base/Raw.h"
#include "base/RefCount.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "sbuf/DetailedStats.h"
#include "sbuf/SBuf.h"
#include "util.h"
#include "base/InstanceId.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "sbuf/forward.h"
#include "sbuf/MemBlob.h"
#include "squid.h"
#include "base/CharacterSet.h"
+#include "base/IoManip.h"
#include "security/CommunicationSecrets.h"
#include "security/Session.h"
*/
#include "squid.h"
+#include "base/IoManip.h"
#include "error/SysErrorDetail.h"
#include "html_quote.h"
#include "sbuf/SBuf.h"
/* DEBUG: section 83 SSL-Bump Server/Peer negotiation */
#include "squid.h"
+#include "base/IoManip.h"
#include "sbuf/Stream.h"
#include "security/Handshake.h"
#if USE_OPENSSL
/* DEBUG: section 83 TLS I/O */
#include "squid.h"
+#include "base/IoManip.h"
#include "fde.h"
#include "security/Io.h"
#include "squid.h"
#include "acl/FilledChecklist.h"
+#include "base/IoManip.h"
#include "comm/Loops.h"
#include "comm/Read.h"
#include "Downloader.h"
#include "squid.h"
#include "base/Packable.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fatal.h"
#include "globals.h"
#include "parser/Tokenizer.h"
#include "anyp/PortCfg.h"
#include "base/RunnersRegistry.h"
#include "CachePeer.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "fd.h"
#include "fde.h"
#include "ipc/MemMap.h"
#include "squid.h"
#include "acl/FilledChecklist.h"
#include "base/CharacterSet.h"
+#include "base/Raw.h"
#include "base/RefCount.h"
#include "base/Subscription.h"
#include "client_side_reply.h"
#include "client_side.h"
#include "comm.h"
#include "comm/Read.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "error/SysErrorDetail.h"
#include "fd.h"
#include "fde.h"
#include "squid.h"
#include "base/TextException.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "ipc/TypedMsgHdr.h"
#include "snmp/Var.h"
#include "tools.h"
*/
#include "squid.h"
+#include "base/Raw.h"
#include "ErrorDetail.h"
#include "ErrorDetailManager.h"
#include "errorpage.h"
/* support.cc says this is needed */
#if USE_OPENSSL
+#include "base/Raw.h"
#include "comm.h"
#include "fd.h"
#include "fde.h"
#include "CollapsedForwarding.h"
#include "comm/Connection.h"
#include "comm/Read.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#if HAVE_DISKIO_MODULE_IPCIO
#include "DiskIO/IpcIo/IpcIoFile.h"
#endif
#include "squid.h"
#include "cache_cf.h"
#include "ConfigParser.h"
-#include "Debug.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "sbuf/Stream.h"
#include "SquidConfig.h"
/* DEBUG: section 47 Store Search */
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "globals.h"
#include "store/LocalSearch.h"
#include "StoreSearch.h"
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "event.h"
#include "globals.h"
#include "mgr/Registration.h"
/* DEBUG: section 20 Storage Manager Logging Functions */
#include "squid.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "format/Token.h"
#include "HttpReply.h"
#include "log/File.h"
/* DEBUG: section 20 Store Rebuild Routines */
#include "squid.h"
-#include "DebugMessages.h"
+#include "debug/Messages.h"
#include "event.h"
#include "globals.h"
#include "md5.h"
#include "squid.h"
#include "CacheManager.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "mgr/Registration.h"
#define STUB_API "cache_manager.cc"
* not abort the unit test.
*/
#include "squid.h"
-#include "Debug.h"
+#include "debug/Stream.h"
-#define STUB_API "debug.cc"
+#define STUB_API "debug/libdebug.la"
#include "tests/STUB.h"
char *Debug::debugOptions;
return s;
}
-std::ostream &
-Raw::print(std::ostream &os) const
-{
- if (label_)
- os << ' ' << label_ << '[' << size_ << ']';
-
- if (!size_)
- return os;
-
- // finalize debugging level if no level was set explicitly via minLevel()
- const int finalLevel = (level >= 0) ? level :
- (size_ > 40 ? DBG_DATA : Debug::SectionLevel());
- if (finalLevel <= Debug::SectionLevel()) {
- os << (label_ ? '=' : ' ');
- if (data_)
- os.write(data_, size_);
- else
- os << "[null]";
- }
-
- return os;
-}
-
#define private public
#define protected public
-#include "Debug.h"
+#include "debug/Stream.h"
#include "http/one/RequestParser.h"
#include "http/RequestMethod.h"
#include "MemBuf.h"
#include <cppunit/TestAssert.h>
#include "anyp/Uri.h"
-#include "Debug.h"
+#include "debug/Stream.h"
#include "tests/testURL.h"
#include "unitTestMain.h"
#include "acl/FilledChecklist.h"
#include "base/CbcPointer.h"
#include "base/JobWait.h"
+#include "base/Raw.h"
#include "CachePeer.h"
#include "cbdata.h"
#include "client_side.h"
endif
## Sort by dependencies - test lowest layers first
-TESTS += debug \
+TESTS += \
syntheticoperators \
VirtualDeleteOperator \
splay\
squid-conf-tests
## Sort by alpha - any build failures are significant.
-check_PROGRAMS += debug \
+check_PROGRAMS += \
$(ESI_TESTS) \
mem_node_test\
mem_hdr_test \
# several tests whose purpose is testing libmem itself.
STUBS = \
stub_cbdata.cc \
- stub_debug.cc \
stub_MemBuf.cc \
stub_SBuf.cc \
stub_tools.cc \
stub_fatal.cc \
+ stub_fd.cc \
STUB.h
DEBUG_SOURCE = test_tools.cc $(STUBS)
CLEANFILES += $(STUBS) stub_libmem.cc
stub_cbdata.cc: $(top_srcdir)/src/tests/stub_cbdata.cc
cp $(top_srcdir)/src/tests/stub_cbdata.cc $@
-stub_debug.cc: $(top_srcdir)/src/tests/stub_debug.cc
- cp $(top_srcdir)/src/tests/stub_debug.cc $@
-
stub_MemBuf.cc: $(top_srcdir)/src/tests/stub_MemBuf.cc
cp $(top_srcdir)/src/tests/stub_MemBuf.cc $@
stub_fatal.cc: $(top_srcdir)/src/tests/stub_fatal.cc
cp $(top_srcdir)/src/tests/stub_fatal.cc $@
+stub_fd.cc: $(top_srcdir)/src/tests/stub_fd.cc
+ cp $(top_srcdir)/src/tests/stub_fd.cc $@
+
stub_libmem.cc: $(top_srcdir)/src/tests/stub_libmem.cc STUB.h
cp $(top_srcdir)/src/tests/stub_libmem.cc $@
STUB.h: $(top_srcdir)/src/tests/STUB.h
cp $(top_srcdir)/src/tests/STUB.h $@
-## XXX: somewhat broken. Its meant to test our debugs() implementation.
-## but it has never been linked to the actual src/debug.cc implementation !!
-## all it tests are the stream operators and macro in src/Debug.h
-debug_SOURCES = \
- $(DEBUG_SOURCE) \
- debug.cc \
- stub_libmem.cc
-
ESIExpressions_SOURCES = \
$(DEBUG_SOURCE) \
ESIExpressions.cc \
stub_libmem.cc
ESIExpressions_LDADD = $(top_builddir)/src/esi/Expression.o \
+ $(top_builddir)/src/debug/libdebug.la \
$(LDADD)
mem_node_test_SOURCES = \
mem_node_test_LDADD = \
$(top_builddir)/src/mem_node.o \
$(top_builddir)/src/mem/libmem.la \
+ $(top_builddir)/src/debug/libdebug.la \
$(LDADD)
mem_hdr_test_SOURCES = \
$(top_builddir)/src/stmem.o \
$(top_builddir)/src/mem_node.o \
$(top_builddir)/src/mem/libmem.la \
+ $(top_builddir)/src/debug/libdebug.la \
$(LDADD)
splay_SOURCES = \
+++ /dev/null
-/*
- * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/* DEBUG: section 19 Store Memory Primitives */
-
-#include "squid.h"
-#include "Debug.h"
-#include "mem_node.h"
-#include "stmem.h"
-
-class StreamTest
-{
-public:
- std::ostream &serialise(std::ostream &);
- int getAnInt() const;
- char const *getACString() const;
-};
-
-static std::ostream &
-operator << (std::ostream &aStream, StreamTest &anObject)
-{
- return anObject.serialise(aStream);
-}
-
-std::ostream&
-StreamTest::serialise(std::ostream &aStream)
-{
- aStream << "stream test";
- return aStream;
-}
-
-int
-StreamTest::getAnInt() const
-{
- return 5;
-}
-
-char const *
-StreamTest::getACString() const
-{
- return "ThisIsAStreamTest";
-}
-
-int
-main(int, char *[])
-{
- Debug::Levels[1] = 8;
- debugs (1,1,"test" << "string");
- debugs (1,9,"do not show this" << "string");
- debugs (1,1,"test" << "string");
- debugs (1,1,"test" << "string");
- if (true)
- debugs(1,9,"this won't compile if the macro is broken.");
- else
- debugs(1, DBG_IMPORTANT,"bar");
- StreamTest aStreamObject;
- StreamTest *streamPointer (&aStreamObject);
- debugs(1, DBG_IMPORTANT,aStreamObject);
- debugs(1, DBG_IMPORTANT,streamPointer->getAnInt() << " " << aStreamObject.getACString());
- return EXIT_SUCCESS;
-}
-
#include "squid.h"
#include "dlink.h"
-#include <iostream>
-
-void
-xassert(const char *msg, const char *file, int line)
-{
- std::cout << "Assertion failed: (" << msg << ") at " << file << ":" << line << std::endl;
- exit (1);
-}
void
dlinkAdd(void *data, dlink_node * m, dlink_list * list)