2009-03-08 01:02:16 +03:00
|
|
|
/* $NetBSD: db_examine.c,v 1.34 2009/03/07 22:02:17 ad Exp $ */
|
1994-06-29 10:29:24 +04:00
|
|
|
|
1994-10-06 08:20:42 +03:00
|
|
|
/*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Mach Operating System
|
|
|
|
* Copyright (c) 1991,1990 Carnegie Mellon University
|
|
|
|
* All Rights Reserved.
|
1994-10-06 08:20:42 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
|
|
* documentation is hereby granted, provided that both the copyright
|
|
|
|
* notice and this permission notice appear in all copies of the
|
|
|
|
* software, derivative works or modified versions, and any portions
|
|
|
|
* thereof, and that both notices appear in supporting documentation.
|
1994-10-06 08:20:42 +03:00
|
|
|
*
|
1999-04-13 00:38:17 +04:00
|
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
1993-03-21 12:45:37 +03:00
|
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
1994-10-06 08:20:42 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Carnegie Mellon requests users of this software to return to
|
1994-10-06 08:20:42 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
|
|
|
* School of Computer Science
|
|
|
|
* Carnegie Mellon University
|
|
|
|
* Pittsburgh PA 15213-3890
|
1994-10-06 08:20:42 +03:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* any improvements or extensions that they make and grant Carnegie the
|
|
|
|
* rights to redistribute these changes.
|
1993-05-20 07:39:04 +04:00
|
|
|
*
|
1993-03-21 12:45:37 +03:00
|
|
|
* Author: David B. Golub, Carnegie Mellon University
|
|
|
|
* Date: 7/90
|
|
|
|
*/
|
1993-12-18 07:46:25 +03:00
|
|
|
|
2001-11-13 01:54:03 +03:00
|
|
|
#include <sys/cdefs.h>
|
2009-03-08 01:02:16 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.34 2009/03/07 22:02:17 ad Exp $");
|
2001-11-13 01:54:03 +03:00
|
|
|
|
1993-12-18 07:46:25 +03:00
|
|
|
#include <sys/param.h>
|
2001-02-24 03:00:12 +03:00
|
|
|
#include <sys/systm.h>
|
2008-11-16 22:34:29 +03:00
|
|
|
#include <sys/buf.h>
|
1993-12-18 07:46:25 +03:00
|
|
|
#include <sys/proc.h>
|
|
|
|
|
2009-03-08 01:02:16 +03:00
|
|
|
#include <ddb/ddb.h>
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static char db_examine_format[TOK_STRING_SIZE] = "x";
|
|
|
|
|
|
|
|
static void db_examine(db_addr_t, char *, int);
|
|
|
|
static void db_search(db_addr_t, int, db_expr_t, db_expr_t, unsigned int);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*
|
1994-09-26 20:10:15 +03:00
|
|
|
* Examine (print) data. Syntax is:
|
|
|
|
* x/[bhl][cdiorsuxz]*
|
|
|
|
* For example, the command:
|
|
|
|
* x/bxxxx
|
|
|
|
* should print:
|
|
|
|
* address: 01 23 45 67
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
/*ARGSUSED*/
|
|
|
|
void
|
2007-02-22 07:38:02 +03:00
|
|
|
db_examine_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
|
2006-10-12 05:30:41 +04:00
|
|
|
const char *modif)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
if (modif[0] != '\0')
|
2003-05-16 20:28:30 +04:00
|
|
|
strlcpy(db_examine_format, modif, sizeof(db_examine_format));
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
if (count == -1)
|
1994-10-06 08:20:42 +03:00
|
|
|
count = 1;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
db_examine((db_addr_t) addr, db_examine_format, count);
|
|
|
|
}
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static void
|
|
|
|
db_examine(db_addr_t addr, char *fmt, int count)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2000-12-28 10:30:06 +03:00
|
|
|
int i, c;
|
1993-03-21 12:45:37 +03:00
|
|
|
db_expr_t value;
|
|
|
|
int size;
|
|
|
|
int width;
|
2000-12-28 10:30:06 +03:00
|
|
|
int bytes;
|
1993-03-21 12:45:37 +03:00
|
|
|
char * fp;
|
2000-08-09 23:51:44 +04:00
|
|
|
char tbuf[24];
|
1994-10-06 08:20:42 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
while (--count >= 0) {
|
1994-10-06 08:20:42 +03:00
|
|
|
fp = fmt;
|
|
|
|
size = 4;
|
1994-11-14 23:40:04 +03:00
|
|
|
width = 12;
|
1994-10-06 08:20:42 +03:00
|
|
|
while ((c = *fp++) != 0) {
|
1994-11-17 07:51:50 +03:00
|
|
|
if (db_print_position() == 0) {
|
|
|
|
/* Always print the address. */
|
2000-05-25 23:57:30 +04:00
|
|
|
db_printsym(addr, DB_STGY_ANY, db_printf);
|
1994-11-17 07:51:50 +03:00
|
|
|
db_printf(":\t");
|
|
|
|
db_prev = addr;
|
|
|
|
}
|
1994-09-26 20:10:15 +03:00
|
|
|
switch (c) {
|
1994-11-17 07:51:50 +03:00
|
|
|
case 'b': /* byte */
|
1994-09-26 20:10:15 +03:00
|
|
|
size = 1;
|
|
|
|
width = 4;
|
|
|
|
break;
|
1994-11-17 07:51:50 +03:00
|
|
|
case 'h': /* half-word */
|
1994-09-26 20:10:15 +03:00
|
|
|
size = 2;
|
|
|
|
width = 8;
|
|
|
|
break;
|
1994-11-17 07:51:50 +03:00
|
|
|
case 'l': /* long-word */
|
1994-09-26 20:10:15 +03:00
|
|
|
size = 4;
|
1994-11-14 23:40:04 +03:00
|
|
|
width = 12;
|
1994-09-26 20:10:15 +03:00
|
|
|
break;
|
1999-05-31 10:53:45 +04:00
|
|
|
case 'L': /* implementation maximum */
|
|
|
|
size = sizeof value;
|
|
|
|
width = 12 * (sizeof value / 4);
|
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'a': /* address */
|
2003-11-09 23:52:18 +03:00
|
|
|
db_printf("= 0x%lx\n", (long)addr);
|
1994-09-26 20:10:15 +03:00
|
|
|
break;
|
|
|
|
case 'r': /* signed, current radix */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, true);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2007-02-22 09:34:42 +03:00
|
|
|
db_format_radix(tbuf, 24, value, false);
|
2000-08-09 23:51:44 +04:00
|
|
|
db_printf("%-*s", width, tbuf);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'x': /* unsigned hex */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%-*qx" : "%-*lx",
|
|
|
|
width, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
2000-12-28 10:30:06 +03:00
|
|
|
case 'm': /* hex dump */
|
2002-02-15 10:33:48 +03:00
|
|
|
/*
|
2000-12-28 10:30:06 +03:00
|
|
|
* Print off in chunks of size. Try to print 16
|
2002-02-15 10:33:48 +03:00
|
|
|
* bytes at a time into 4 columns. This
|
2000-12-28 10:30:06 +03:00
|
|
|
* loops modify's count extra times in order
|
|
|
|
* to get the nicely formatted lines.
|
|
|
|
*/
|
2002-02-15 10:33:48 +03:00
|
|
|
|
2000-12-28 10:30:06 +03:00
|
|
|
bytes = 0;
|
|
|
|
do {
|
|
|
|
for (i = 0; i < size; i++) {
|
2002-02-15 10:33:48 +03:00
|
|
|
value =
|
2000-12-28 10:30:06 +03:00
|
|
|
db_get_value(addr+bytes, 1,
|
2007-02-22 09:34:42 +03:00
|
|
|
false);
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(
|
|
|
|
DB_EXPR_T_IS_QUAD ? "%02qx":
|
|
|
|
"%02lx", value);
|
2000-12-28 10:30:06 +03:00
|
|
|
bytes++;
|
|
|
|
if (!(bytes % 4))
|
|
|
|
db_printf(" ");
|
|
|
|
}
|
|
|
|
} while ((bytes != 16) && count--);
|
|
|
|
/* True up the columns before continuing */
|
|
|
|
for (i = 4; i >= (bytes / 4); i--)
|
|
|
|
db_printf ("\t");
|
|
|
|
/* Print chars, use . for non-printable's. */
|
|
|
|
while (bytes--) {
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, 1, false);
|
2000-12-28 10:30:06 +03:00
|
|
|
addr += 1;
|
|
|
|
if (value >= ' ' && value <= '~')
|
|
|
|
db_printf("%c", (char)value);
|
|
|
|
else
|
|
|
|
db_printf(".");
|
2002-02-15 10:33:48 +03:00
|
|
|
}
|
2000-12-28 10:30:06 +03:00
|
|
|
db_printf("\n");
|
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'z': /* signed hex */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, true);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2007-02-22 09:34:42 +03:00
|
|
|
db_format_hex(tbuf, 24, value, false);
|
2000-08-09 23:51:44 +04:00
|
|
|
db_printf("%-*s", width, tbuf);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'd': /* signed decimal */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, true);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%-*qd" : "%-*ld",
|
|
|
|
width, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'u': /* unsigned decimal */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%-*qu" : "%-*lu",
|
|
|
|
width, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'o': /* unsigned octal */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, size, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += size;
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%-*qo" : "%-*lo",
|
|
|
|
width, value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'c': /* character */
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, 1, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
addr += 1;
|
|
|
|
if (value >= ' ' && value <= '~')
|
1997-02-04 02:36:09 +03:00
|
|
|
db_printf("%c", (char)value);
|
1993-03-21 12:45:37 +03:00
|
|
|
else
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf("\\%03o", (int)value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 's': /* null-terminated string */
|
1993-03-21 12:45:37 +03:00
|
|
|
for (;;) {
|
2007-02-22 09:34:42 +03:00
|
|
|
value = db_get_value(addr, 1, false);
|
1994-10-06 08:20:42 +03:00
|
|
|
addr += 1;
|
|
|
|
if (value == 0)
|
1994-09-26 20:10:15 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
if (value >= ' ' && value <= '~')
|
1997-02-04 02:36:09 +03:00
|
|
|
db_printf("%c", (char)value);
|
1994-10-06 08:20:42 +03:00
|
|
|
else
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf("\\%03o", (int)value);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'i': /* instruction */
|
2007-02-22 09:34:42 +03:00
|
|
|
addr = db_disasm(addr, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
case 'I': /* instruction, alternate form */
|
2007-02-22 09:34:42 +03:00
|
|
|
addr = db_disasm(addr, true);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-09-26 20:10:15 +03:00
|
|
|
default:
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (db_print_position() != 0)
|
1994-09-26 20:10:15 +03:00
|
|
|
db_end_line();
|
1994-10-06 08:20:42 +03:00
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
db_next = addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Print value.
|
|
|
|
*/
|
2002-02-15 10:33:48 +03:00
|
|
|
static char db_print_format = 'x';
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
/*ARGSUSED*/
|
|
|
|
void
|
2007-02-22 07:38:02 +03:00
|
|
|
db_print_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
|
2006-10-12 05:30:41 +04:00
|
|
|
const char *modif)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
db_expr_t value;
|
|
|
|
|
|
|
|
if (modif[0] != '\0')
|
1994-10-06 08:20:42 +03:00
|
|
|
db_print_format = modif[0];
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
switch (db_print_format) {
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'a':
|
2000-05-25 23:57:30 +04:00
|
|
|
db_printsym((db_addr_t)addr, DB_STGY_ANY, db_printf);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'r':
|
2000-08-09 23:51:44 +04:00
|
|
|
{
|
|
|
|
char tbuf[24];
|
|
|
|
|
2007-02-22 09:34:42 +03:00
|
|
|
db_format_radix(tbuf, 24, addr, false);
|
2000-08-09 23:51:44 +04:00
|
|
|
db_printf("%11s", tbuf);
|
|
|
|
break;
|
|
|
|
}
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'x':
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%16qx" : "%8lx", addr);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'z':
|
2000-08-09 23:51:44 +04:00
|
|
|
{
|
|
|
|
char tbuf[24];
|
|
|
|
|
2007-02-22 09:34:42 +03:00
|
|
|
db_format_hex(tbuf, 24, addr, false);
|
2000-08-09 23:51:44 +04:00
|
|
|
db_printf("%8s", tbuf);
|
|
|
|
break;
|
|
|
|
}
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'd':
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%11qd" : "%11ld", addr);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'u':
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%11qu" : "%11lu", addr);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'o':
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf(DB_EXPR_T_IS_QUAD ? "%15qo" : "%16lo", addr);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
1994-10-06 08:20:42 +03:00
|
|
|
case 'c':
|
1993-03-21 12:45:37 +03:00
|
|
|
value = addr & 0xFF;
|
|
|
|
if (value >= ' ' && value <= '~')
|
1997-02-04 02:36:09 +03:00
|
|
|
db_printf("%c", (char)value);
|
1993-03-21 12:45:37 +03:00
|
|
|
else
|
2003-05-17 13:58:03 +04:00
|
|
|
db_printf("\\%03o", (int)value);
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
db_printf("\n");
|
|
|
|
}
|
|
|
|
|
1996-02-05 04:56:47 +03:00
|
|
|
void
|
2002-02-15 10:33:48 +03:00
|
|
|
db_print_loc_and_inst(db_addr_t loc)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
2002-02-15 10:33:48 +03:00
|
|
|
|
2000-05-25 23:57:30 +04:00
|
|
|
db_printsym(loc, DB_STGY_PROC, db_printf);
|
1993-03-21 12:45:37 +03:00
|
|
|
db_printf(":\t");
|
2007-02-22 09:34:42 +03:00
|
|
|
(void) db_disasm(loc, false);
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Search for a value in memory.
|
|
|
|
* Syntax: search [/bhl] addr value [mask] [,count]
|
|
|
|
*/
|
1996-02-05 04:56:47 +03:00
|
|
|
/*ARGSUSED*/
|
1993-03-21 12:45:37 +03:00
|
|
|
void
|
2007-02-22 07:38:02 +03:00
|
|
|
db_search_cmd(db_expr_t daddr, bool have_addr,
|
2006-11-16 04:32:37 +03:00
|
|
|
db_expr_t dcount, const char *modif)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
int t;
|
|
|
|
db_addr_t addr;
|
|
|
|
int size;
|
|
|
|
db_expr_t value;
|
|
|
|
db_expr_t mask;
|
1997-02-03 22:56:03 +03:00
|
|
|
db_expr_t count;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
t = db_read_token();
|
|
|
|
if (t == tSLASH) {
|
1994-10-06 08:20:42 +03:00
|
|
|
t = db_read_token();
|
|
|
|
if (t != tIDENT) {
|
|
|
|
bad_modifier:
|
|
|
|
db_printf("Bad modifier\n");
|
|
|
|
db_flush_lex();
|
|
|
|
return;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-10-06 08:20:42 +03:00
|
|
|
if (!strcmp(db_tok_string, "b"))
|
|
|
|
size = 1;
|
|
|
|
else if (!strcmp(db_tok_string, "h"))
|
|
|
|
size = 2;
|
|
|
|
else if (!strcmp(db_tok_string, "l"))
|
|
|
|
size = 4;
|
|
|
|
else
|
|
|
|
goto bad_modifier;
|
1993-03-21 12:45:37 +03:00
|
|
|
} else {
|
1994-10-06 08:20:42 +03:00
|
|
|
db_unread_token(t);
|
|
|
|
size = 4;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
1996-02-05 04:56:47 +03:00
|
|
|
if (!db_expression(&value)) {
|
1994-10-06 08:20:42 +03:00
|
|
|
db_printf("Address missing\n");
|
|
|
|
db_flush_lex();
|
|
|
|
return;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
1996-02-05 04:56:47 +03:00
|
|
|
addr = (db_addr_t) value;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
if (!db_expression(&value)) {
|
1994-10-06 08:20:42 +03:00
|
|
|
db_printf("Value missing\n");
|
|
|
|
db_flush_lex();
|
|
|
|
return;
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!db_expression(&mask))
|
1996-02-05 04:56:47 +03:00
|
|
|
mask = (int) ~0;
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
t = db_read_token();
|
|
|
|
if (t == tCOMMA) {
|
1994-10-06 08:20:42 +03:00
|
|
|
if (!db_expression(&count)) {
|
|
|
|
db_printf("Count missing\n");
|
|
|
|
db_flush_lex();
|
|
|
|
return;
|
|
|
|
}
|
1993-03-21 12:45:37 +03:00
|
|
|
} else {
|
1994-10-06 08:20:42 +03:00
|
|
|
db_unread_token(t);
|
|
|
|
count = -1; /* effectively forever */
|
1993-03-21 12:45:37 +03:00
|
|
|
}
|
|
|
|
db_skip_to_eol();
|
|
|
|
|
|
|
|
db_search(addr, size, value, mask, count);
|
|
|
|
}
|
|
|
|
|
2002-02-15 10:33:48 +03:00
|
|
|
static void
|
|
|
|
db_search(db_addr_t addr, int size, db_expr_t value, db_expr_t mask,
|
|
|
|
unsigned int count)
|
1993-03-21 12:45:37 +03:00
|
|
|
{
|
|
|
|
while (count-- != 0) {
|
|
|
|
db_prev = addr;
|
2007-02-22 09:34:42 +03:00
|
|
|
if ((db_get_value(addr, size, false) & mask) == value)
|
1993-03-21 12:45:37 +03:00
|
|
|
break;
|
|
|
|
addr += size;
|
|
|
|
}
|
|
|
|
db_next = addr;
|
|
|
|
}
|