Package: visualboyadvance / 1.8.0.dfsg-4

04_fix_gtk_with_DBKPT_SUPPORT.patch Patch series | download
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
Author: Jose Carlos Medeiros <debian@psabs.com.br>
Description: Enable console output (-DBKPT_SUPPORT).
--- a/src/gtk/Makefile.am
+++ b/src/gtk/Makefile.am
@@ -5,6 +5,7 @@
 noinst_LIBRARIES = libgba.a
 
 gvba_SOURCES = \
+	debugger.cpp		\
 	configfile.cpp		\
 	configfile.h		\
 	filters.cpp		\
--- /dev/null
+++ b/src/gtk/debugger.cpp
@@ -0,0 +1,53 @@
+// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
+// Copyright (C) 1999-2003 Forgotten
+// Copyright (C) 2004 Forgotten and the VBA development team
+
+// 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../GBA.h"
+#include "../Port.h"
+#include "../armdis.h"
+#include "../elf.h"
+#include "../exprNode.h"
+
+extern bool debugger;
+extern int emulating;
+
+extern struct EmulatedSystem emulator;
+
+void debuggerBreakOnWrite(u32 *mem, u32 oldvalue, u32 value, int size)
+{
+  u32 address = 0;
+  if(mem >= (u32*)&workRAM[0] && mem <= (u32*)&workRAM[0x3ffff])
+    address = 0x2000000 + ((unsigned long)mem - (unsigned long)&workRAM[0]);
+  else
+    address = 0x3000000 + ((unsigned long)mem - (unsigned long)&internalRAM[0]);
+
+  if(size == 2)
+    printf("Breakpoint (on write) address %08x old:%08x new:%08x\n", 
+           address, oldvalue, value);
+  else if(size == 1)
+    printf("Breakpoint (on write) address %08x old:%04x new:%04x\n", 
+           address, (u16)oldvalue,(u16)value);
+  else
+    printf("Breakpoint (on write) address %08x old:%02x new:%02x\n", 
+           address, (u8)oldvalue, (u8)value);
+  debugger = true;
+}
+