summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debugger.h
blob: fed1da3b997d7fde4865065c68d844a398c89b08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/****************************************************************************

    debugger.h

    General debugging interfaces

    Copyright Nicola Salmoria and the MAME Team.
    Visit http://mamedev.org for licensing and usage restrictions.

****************************************************************************/

#pragma once

#ifndef __DEBUGGER_H__
#define __DEBUGGER_H__

#include "mame.h"
#include "deprecat.h"
#include "debug/debugcpu.h"


/***************************************************************************
    FUNCTION PROTOTYPES
***************************************************************************/

/* ----- core debugger functions ----- */

/* initialize the debugger */
void debugger_init(running_machine *machine);

/* redraw the current video display */
void debugger_refresh_display(running_machine *machine);



/***************************************************************************
    INLINE FUNCTIONS
***************************************************************************/

/*-------------------------------------------------
    debugger_instruction_hook - CPU cores call 
    this once per instruction from CPU cores
-------------------------------------------------*/

INLINE void debugger_instruction_hook(running_machine *machine, offs_t curpc)
{
	if ((machine->debug_flags & DEBUG_FLAG_CALL_HOOK) != 0)
		debug_cpu_instruction_hook(machine, curpc);
}


/*-------------------------------------------------
    debugger_start_cpu_hook - the CPU execution 
    system calls this hook before beginning 
    execution for the given CPU
-------------------------------------------------*/

INLINE void debugger_start_cpu_hook(running_machine *machine, int cpunum, attotime endtime)
{
	if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
		debug_cpu_start_hook(machine, cpunum, endtime);
}


/*-------------------------------------------------
    debugger_stop_cpu_hook - the CPU execution 
    system calls this hook when ending execution 
    for the given CPU
-------------------------------------------------*/

INLINE void debugger_stop_cpu_hook(running_machine *machine, int cpunum)
{
	if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
		debug_cpu_stop_hook(machine, cpunum);
}


/*-------------------------------------------------
    debugger_break - stop in the debugger at the
    next opportunity
-------------------------------------------------*/

INLINE void debugger_break(running_machine *machine)
{
	if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
		debug_cpu_halt_on_next_instruction(machine);
}


/*-------------------------------------------------
    debugger_within_instruction_hook - call this 
    to determine if the debugger is currently 
    halted within the instruction hook
-------------------------------------------------*/

INLINE int debugger_within_instruction_hook(running_machine *machine)
{
	if ((machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
		return debug_cpu_within_instruction_hook(machine);
	return FALSE;
}


#endif	/* __DEBUGGER_H__ */