When opening the file we don't need MMIO_EXCLUSIVE
[wine/multimedia.git] / debugger / display.c
blob74a75196d42bdbc657662dc60ef9deb2d1d30abe
1 /*
2 * File display.c - display handling for Wine internal debugger.
4 * Copyright (C) 1997, Eric Youngdale.
6 */
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <string.h>
11 #include <limits.h>
12 #include <sys/types.h>
13 #include <neexe.h>
14 #include "module.h"
15 #include "selectors.h"
16 #include "debugger.h"
18 #include <stdarg.h>
20 #define MAX_DISPLAY 25
22 struct display
24 struct expr * exp;
25 int count;
26 char format;
29 static struct display displaypoints[MAX_DISPLAY];
31 int
32 DEBUG_AddDisplay(struct expr * exp, int count, char format)
34 int i;
37 * First find a slot where we can store this display.
39 for(i=0; i < MAX_DISPLAY; i++ )
41 if( displaypoints[i].exp == NULL )
43 displaypoints[i].exp = DEBUG_CloneExpr(exp);
44 displaypoints[i].count = count;
45 displaypoints[i].format = format;
46 break;
50 return TRUE;
53 int
54 DEBUG_InfoDisplay()
56 int i;
59 * First find a slot where we can store this display.
61 for(i=0; i < MAX_DISPLAY; i++ )
63 if( displaypoints[i].exp != NULL )
65 fprintf(stderr, "%d : ", i+1);
66 DEBUG_DisplayExpr(displaypoints[i].exp);
67 fprintf(stderr, "\n");
71 return TRUE;
74 int
75 DEBUG_DoDisplay()
77 DBG_ADDR addr;
78 int i;
81 * First find a slot where we can store this display.
83 for(i=0; i < MAX_DISPLAY; i++ )
85 if( displaypoints[i].exp != NULL )
87 addr = DEBUG_EvalExpr(displaypoints[i].exp);
88 if( addr.type == NULL )
90 fprintf(stderr, "Unable to evaluate expression ");
91 DEBUG_DisplayExpr(displaypoints[i].exp);
92 fprintf(stderr, "\nDisabling...\n");
93 DEBUG_DelDisplay(i);
95 else
97 fprintf(stderr, "%d : ", i + 1);
98 DEBUG_DisplayExpr(displaypoints[i].exp);
99 fprintf(stderr, " = ");
100 if( displaypoints[i].format == 'i' )
102 DEBUG_ExamineMemory( &addr,
103 displaypoints[i].count,
104 displaypoints[i].format);
106 else
108 DEBUG_Print( &addr,
109 displaypoints[i].count,
110 displaypoints[i].format, 0);
116 return TRUE;
120 DEBUG_DelDisplay(int displaynum)
122 int i;
124 if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
126 fprintf(stderr, "Invalid display number\n");
127 return TRUE;
129 if( displaynum == -1 )
131 for(i=0; i < MAX_DISPLAY; i++ )
133 if( displaypoints[i].exp != NULL )
135 DEBUG_FreeExpr(displaypoints[i].exp);
136 displaypoints[i].exp = NULL;
140 else if( displaypoints[displaynum - 1].exp != NULL )
142 DEBUG_FreeExpr(displaypoints[displaynum - 1].exp);
143 displaypoints[displaynum - 1].exp = NULL;
145 return TRUE;