/* Native-dependent code for MorphOS.

   Copyright (C) 2004-2019 Free Software Foundation, Inc.

   This file is part of GDB.

   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/>.  */

#ifndef MORPHOS_NAT_H
#define MORPHOS_NAT_H

#define TS_FROZEN 0xff

enum
{
	TASKEVENT_ADDCHILD = 100,
	TASKEVENT_REMCHILD
};

struct DebugInfo
{
	struct Task *debuggertask;
	unsigned int debuggersigmask;
	BYTE debuggersignum;
	struct MsgPort *debuggerport;
	struct Task *exceptionhandler;
	struct MsgPort *exceptionhandlerport;
	unsigned int exceptionhandlershouldquit;
	struct Task *childtask;
	BPTR childsegs;
	struct Task *orgchildtask;
	BPTR orgchildsegs;
	struct Task *prevchildtask;
	BPTR prevchildsegs;
	unsigned int programended;
	unsigned int childstarted;
	unsigned int attaching;
	unsigned int frozen;
	LONG ProgramReturnCode;
	UBYTE oldtaskstate;
	UBYTE oldchildtaskstate;
	struct Hook exechook;
	
	char *arguments;
	char *namebuf;
	char *argsbuf;
	
	unsigned int lastexceptionsrr0;
	unsigned int lastexceptionlr;
	unsigned int lastexceptionctr;
	unsigned int lastexceptioncr;
	unsigned int lastexceptionr1;
	
	unsigned int srr0;
	unsigned int r1;
	
	unsigned int temporarybreakpointaddress;
	unsigned int temporarybreakpointvalue;
	unsigned int temporarilydisabledbreakpointaddress;
	
	unsigned int flags;
};

#define DEBUGINFOF_SINGLESTEP        (1<<0)
#define DEBUGINFOF_STEPOVER          (1<<1)

struct DebugEvent
{
	struct Message Message;
	unsigned int Type;
	unsigned int DAR;
	unsigned int DSISR;
	unsigned int SRR0;
	unsigned int LR;
	unsigned int CTR;
	unsigned int CR;
	unsigned int XER;
	unsigned int GPR[32];
	unsigned int Stopped;
	unsigned int SegOffset;
	Task *ChildOfDebugtask;
};

#endif
