/* Copyright (C) 2008 Emmanuel Varoquaux This file is part of XOS. 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 3 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, see . */ #ifndef _DEBUG_H #define _DEBUG_H #include #define LOG_POS "%s:%d (%s)" #define LOG_PREFIX LOG_POS ": " #define printpos() printk(LOG_POS "\n", __FILE__, __LINE__, __func__) #define printd(format, ...) printk(LOG_PREFIX format, __FILE__, __LINE__, __func__, ## __VA_ARGS__) void _log(const char *file, int line, const char *func, const char *format, ...) __attribute__ ((format (printf, 4, 5))); #define log(format, ...) _log(__FILE__, __LINE__, __func__, (format), ## __VA_ARGS__) void _log_maps(const char *file, int line, const char *func, int pid); #define log_maps(pid) _log_maps(__FILE__, __LINE__, __func__, (pid)) #endif