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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/*
* File display.c - display handling for Wine internal debugger.
*
* Copyright (C) 1997, Eric Youngdale.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <neexe.h>
#include "module.h"
#include "selectors.h"
#include "debugger.h"
#include "xmalloc.h"
#include <stdarg.h>
#define MAX_DISPLAY 25
struct display
{
struct expr * exp;
int count;
char format;
};
static struct display displaypoints[MAX_DISPLAY];
int
DEBUG_AddDisplay(struct expr * exp, int count, char format)
{
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i].exp == NULL )
{
displaypoints[i].exp = DEBUG_CloneExpr(exp);
displaypoints[i].count = count;
displaypoints[i].format = format;
break;
}
}
return TRUE;
}
int
DEBUG_InfoDisplay()
{
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i].exp != NULL )
{
fprintf(stderr, "%d : ", i+1);
DEBUG_DisplayExpr(displaypoints[i].exp);
fprintf(stderr, "\n");
}
}
return TRUE;
}
int
DEBUG_DoDisplay()
{
DBG_ADDR addr;
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i].exp != NULL )
{
addr = DEBUG_EvalExpr(displaypoints[i].exp);
if( addr.type == NULL )
{
fprintf(stderr, "Unable to evaluate expression ");
DEBUG_DisplayExpr(displaypoints[i].exp);
fprintf(stderr, "\nDisabling...\n");
DEBUG_DelDisplay(i);
}
else
{
fprintf(stderr, "%d : ", i + 1);
DEBUG_DisplayExpr(displaypoints[i].exp);
fprintf(stderr, " = ");
if( displaypoints[i].format == 'i' )
{
DEBUG_ExamineMemory( &addr,
displaypoints[i].count,
displaypoints[i].format);
}
else
{
DEBUG_Print( &addr,
displaypoints[i].count,
displaypoints[i].format, 0);
}
}
}
}
return TRUE;
}
int
DEBUG_DelDisplay(int displaynum)
{
int i;
if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
{
fprintf(stderr, "Invalid display number\n");
return TRUE;
}
if( displaynum == -1 )
{
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i].exp != NULL )
{
DEBUG_FreeExpr(displaypoints[i].exp);
displaypoints[i].exp = NULL;
}
}
}
else if( displaypoints[displaynum - 1].exp != NULL )
{
DEBUG_FreeExpr(displaypoints[displaynum - 1].exp);
displaypoints[displaynum - 1].exp = NULL;
}
return TRUE;
}
|