/*
Copyright (C) 2006 Evan Teran
                   eteran@alum.rit.edu

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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef DEBUGGER_20061101_H_
#define DEBUGGER_20061101_H_

#include "types.h"
#include <QString>
#include <QList>
#include <QByteArray>

class DebuggerCoreInterface;
class MemoryRegions;
class QWidget;
class QDialog;
class SymbolManager;
class DebugEventHandlerInterface;
class Configuration;

namespace Debugger {

	// breakpoint managment
	void removeBreakPoint(BaseTypes::address_t address);
	void createBreakPoint(BaseTypes::address_t address);
	void toggleBreakPoint(BaseTypes::address_t address);
	
	bool dumpDataRange(BaseTypes::address_t address, BaseTypes::address_t end_address, bool newTab);
	bool dumpDataRange(BaseTypes::address_t address, BaseTypes::address_t end_address);	
	bool dumpData(BaseTypes::address_t address, bool newTab);
	bool dumpData(BaseTypes::address_t address);
	bool dumpStack(BaseTypes::address_t address);
	bool jumpToAddress(BaseTypes::address_t address);
	
	// ask the user for a dword via an input box
	bool getValueFromUser(unsigned int &value);
	bool getValueFromUser(unsigned int &value, const QString &title);
	
	bool getBinaryStringFromUser(QByteArray &value, int maxLength = 0);
	bool getBinaryStringFromUser(QByteArray &value, const QString &title, int maxLength = 0);
	
	// application managment
	bool attachToProcess(BaseTypes::pid_t pid);
	
	// some useful objects
	extern DebugEventHandlerInterface *debugEventHandler;
	extern SymbolManager *symbolManager;
	extern MemoryRegions *memoryRegions;
	extern DebuggerCoreInterface *debuggerBase;
	extern QWidget *debuggerGUI;
	
	// loaded librarys
	QList<QString> loadedLibraries();

	// configuration
	QDialog *dialogOptions();
	const Configuration *config();

	// logging, use this instead of printf/cout
	void log(const QString &s);
	
	// a numeric version of the current version suitable for integer comparison
	unsigned long intVersion(const QString &s);
	unsigned long intVersion();
}

#endif
