Descent3/ddebug/debug.h

176 lines
4.7 KiB
C
Raw Normal View History

/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* 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 <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
2024-04-16 03:43:29 +00:00
* $Logfile: /DescentIII/Main/lib/debug.h $
* $Revision: 23 $
* $Date: 4/19/00 5:20p $
* $Author: Matt $
*
* Debug functions
*
* $Log: /DescentIII/Main/lib/debug.h $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 23 4/19/00 5:20p Matt
* From Duane for 1.4
* Mac debug_break changes
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 22 10/21/99 9:27p Jeff
* B.A. Macintosh code merge
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 21 7/28/99 3:25p Kevin
* Macintosh!
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 20 4/17/99 7:50p Jeff
* kill keyboard thread before int3 in linux (else it locks up)...temp
* hack until I replace ddio key
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 19 4/12/99 7:14p Samir
* added multiple pages per mono window.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 18 1/13/99 6:47a Jeff
* fixed debug_break() for linux
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 17 1/09/99 1:11a Jeff
* put in #ifdef around some windows specific code
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 16 1/05/99 4:28p Kevin
* Moved exception handling code to windebug.cpp
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 15 10/18/98 8:52p Matt
* Revamped debug/error system.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 14 10/13/98 12:03p Kevin
* Changed use of preprocessors for debug, etc.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 13 10/12/98 10:20a Samir
* added parameter to debug init.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 12 6/23/98 2:40p Matt
* Added Yes/No/Cancel type to OutrageMessageBox() and
* Debug_MesssageBox(), and changed return value from a bool to an
* integer.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 11 5/12/98 11:45a Samir
* added logfile.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 10 4/08/98 7:19p Samir
* Added runtime debugging option.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 9 4/07/98 9:20p Samir
* Changes to debug stuff.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 8 4/03/98 5:15p Samir
* Implemented simple debug message filtering.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 7 3/20/98 2:43p Samir
* Some better Int3 support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 6 3/10/98 5:16p Samir
* Got debug callbacks working when you hit an Int3.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 5 1/29/98 12:24p Samir
* Added logfile support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 4 1/28/98 11:17a Samir
* Added debugbreak stuff.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 10/13/97 2:41p Samir
* Debug breaks now are macros to work depending on the operating system.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 9/04/97 12:00p Matt
* Changed Debug_MessageBox() to return bool instead of int, since it was
* already being used that way.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 1 6/10/97 4:54p Samir
* Took headers from gameos.h and isolated them.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* $NoKeywords: $
*/
#ifndef DEBUG_H
#define DEBUG_H
2024-04-16 03:43:29 +00:00
// ---------------------------------------------------------------------------
// Debug system is a member of the 'platform' library.
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#ifndef IDOK
2024-04-16 18:56:40 +00:00
#define IDOK 1
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDCANCEL
2024-04-16 18:56:40 +00:00
#define IDCANCEL 2
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDABORT
2024-04-16 18:56:40 +00:00
#define IDABORT 3
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDRETRY
2024-04-16 18:56:40 +00:00
#define IDRETRY 4
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDIGNORE
2024-04-16 18:56:40 +00:00
#define IDIGNORE 5
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDYES
2024-04-16 18:56:40 +00:00
#define IDYES 6
2024-04-16 03:43:29 +00:00
#endif
#ifndef IDNO
2024-04-16 18:56:40 +00:00
#define IDNO 7
2024-04-16 03:43:29 +00:00
#endif
2024-04-16 20:59:11 +00:00
// #define DEBUG_LEVEL 0 //DAJ
#if defined(WIN32) || defined(POSIX)
constexpr const int OSMBOX_OK = 1;
constexpr const int OSMBOX_YESNO = 2;
constexpr const int OSMBOX_YESNOCANCEL = 3;
constexpr const int OSMBOX_ABORTRETRYIGNORE = 4;
constexpr const int OSMBOX_OKCANCEL = 5;
2024-04-16 03:43:29 +00:00
#else
2024-04-16 18:56:40 +00:00
#define OSMBOX_OK 1
#define OSMBOX_YESNO 2
#define OSMBOX_YESNOCANCEL 3
#define OSMBOX_ABORTRETRYIGNORE 4
#define OSMBOX_OKCANCEL 5
2024-04-16 03:43:29 +00:00
#endif
// ---------------------------------------------------------------------------
// Functions
// ---------------------------------------------------------------------------
extern bool Debug_break;
// if we are running under a debugger, then pass true
bool Debug_Init(bool debugger);
2024-04-16 18:56:40 +00:00
// Does a messagebox with a stack dump
// Messagebox shows topstring, then stack dump, then bottomstring
// Return types are the same as the Windows return values
int Debug_ErrorBox(int type, const char *topstring, const char *title, const char *bottomstring);
// displays a message box
2024-04-16 03:43:29 +00:00
// Returns the same values as the Win32 MessageBox() function
2024-04-16 18:56:40 +00:00
int Debug_MessageBox(int type, const char *title, const char *str);
// these functions deal with debug spew support
void Debug_ConsolePrintf(int n, const char *format, ...);
2024-04-16 18:56:40 +00:00
#if defined(WIN32)
#include <windows.h>
long WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data);
2024-04-16 03:43:29 +00:00
#endif
2024-04-16 03:43:29 +00:00
#endif