debug.h revision 929bd57ca202fd2f2e8485ebf65d683e664f67b5
1e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata/* 2e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * This file is part of ltrace. 34392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata * Copyright (C) 2012 Petr Machata, Red Hat Inc. 4e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * Copyright (C) 2003,2009 Juan Cespedes 5e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * 6e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * This program is free software; you can redistribute it and/or 7e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * modify it under the terms of the GNU General Public License as 8e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * published by the Free Software Foundation; either version 2 of the 9e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * License, or (at your option) any later version. 10e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * 11e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * This program is distributed in the hope that it will be useful, but 12e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * WITHOUT ANY WARRANTY; without even the implied warranty of 13e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * General Public License for more details. 15e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * 16e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * You should have received a copy of the GNU General Public License 17e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * along with this program; if not, write to the Free Software 18e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata * 02110-1301 USA 20e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata */ 21e99af270a60891e68d465c4cd97dbe29cd1a05e4Petr Machata 22ca233087ebca08c826cc9f43f6ac01d6ff94243cArnaud Patard#ifndef _DEBUG_H 23ca233087ebca08c826cc9f43f6ac01d6ff94243cArnaud Patard#define _DEBUG_H 24ca233087ebca08c826cc9f43f6ac01d6ff94243cArnaud Patard 254392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata#include "backend.h" 264392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata#include "forward.h" 274392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata 28cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedes/* debug levels: 29cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedes */ 30cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedesenum { 31c5c744a3b5a6e0d1f4826fabb31ffab2ec0170f3Juan Cespedes DEBUG_EVENT = 010, 32c5c744a3b5a6e0d1f4826fabb31ffab2ec0170f3Juan Cespedes DEBUG_PROCESS = 020, 33c5c744a3b5a6e0d1f4826fabb31ffab2ec0170f3Juan Cespedes DEBUG_FUNCTION = 040 34cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedes}; 35cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedes 36cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedesvoid debug_(int level, const char *file, int line, 37cd8976dbee947f152c3a322503a1063c6359da76Juan Cespedes const char *fmt, ...) __attribute__((format(printf,4,5))); 389a2ad351a1c3215dc596ff3e2e3fd4bc24445a6bIan Wienand 394392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata/* Dump LENGTH bytes of memory starting on address ADDR of inferior 404392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata * PID. */ 41929bd57ca202fd2f2e8485ebf65d683e664f67b5Petr Machataint xinfdump(struct process *proc, arch_addr_t addr, size_t length); 429a2ad351a1c3215dc596ff3e2e3fd4bc24445a6bIan Wienand 434392d965241b7ce8294d4cc53077eaa6a1132147Petr Machata#define debug(level, expr...) debug_(level, __FILE__, __LINE__, expr) 44cac15c3f170b5ec2cc6304c8c0763a78103e1778Juan Cespedes 45ca233087ebca08c826cc9f43f6ac01d6ff94243cArnaud Patard#endif 46