Deleted Added
full compact
db_examine.c (256281) db_examine.c (273265)
1/*-
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the

--- 15 unchanged lines hidden (view full) ---

24 * rights to redistribute these changes.
25 */
26/*
27 * Author: David B. Golub, Carnegie Mellon University
28 * Date: 7/90
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the

--- 15 unchanged lines hidden (view full) ---

24 * rights to redistribute these changes.
25 */
26/*
27 * Author: David B. Golub, Carnegie Mellon University
28 * Date: 7/90
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/10/sys/ddb/db_examine.c 176914 2008-03-07 18:09:07Z rwatson $");
32__FBSDID("$FreeBSD: stable/10/sys/ddb/db_examine.c 273265 2014-10-18 19:22:59Z pfg $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36
37#include <ddb/ddb.h>
38
39#include <ddb/db_lex.h>
40#include <ddb/db_output.h>

--- 6 unchanged lines hidden (view full) ---

47static void db_examine(db_addr_t, char *, int);
48static void db_search(db_addr_t, int, db_expr_t, db_expr_t, u_int);
49
50/*
51 * Examine (print) data.
52 */
53/*ARGSUSED*/
54void
33
34#include <sys/param.h>
35#include <sys/systm.h>
36
37#include <ddb/ddb.h>
38
39#include <ddb/db_lex.h>
40#include <ddb/db_output.h>

--- 6 unchanged lines hidden (view full) ---

47static void db_examine(db_addr_t, char *, int);
48static void db_search(db_addr_t, int, db_expr_t, db_expr_t, u_int);
49
50/*
51 * Examine (print) data.
52 */
53/*ARGSUSED*/
54void
55db_examine_cmd(addr, have_addr, count, modif)
56 db_expr_t addr;
57 boolean_t have_addr;
58 db_expr_t count;
59 char * modif;
55db_examine_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
56 char *modif)
60{
61 if (modif[0] != '\0')
62 db_strcpy(db_examine_format, modif);
63
64 if (count == -1)
65 count = 1;
66
67 db_examine((db_addr_t) addr, db_examine_format, count);
68}
69
70static void
57{
58 if (modif[0] != '\0')
59 db_strcpy(db_examine_format, modif);
60
61 if (count == -1)
62 count = 1;
63
64 db_examine((db_addr_t) addr, db_examine_format, count);
65}
66
67static void
71db_examine(addr, fmt, count)
72 register
73 db_addr_t addr;
74 char * fmt; /* format string */
75 int count; /* repeat count */
68db_examine(db_addr_t addr, char *fmt, int count)
76{
77 int c;
78 db_expr_t value;
79 int size;
80 int width;
81 char * fp;
82
83 while (--count >= 0 && !db_pager_quit) {

--- 108 unchanged lines hidden (view full) ---

192
193/*
194 * Print value.
195 */
196static char db_print_format = 'x';
197
198/*ARGSUSED*/
199void
69{
70 int c;
71 db_expr_t value;
72 int size;
73 int width;
74 char * fp;
75
76 while (--count >= 0 && !db_pager_quit) {

--- 108 unchanged lines hidden (view full) ---

185
186/*
187 * Print value.
188 */
189static char db_print_format = 'x';
190
191/*ARGSUSED*/
192void
200db_print_cmd(addr, have_addr, count, modif)
201 db_expr_t addr;
202 boolean_t have_addr;
203 db_expr_t count;
204 char * modif;
193db_print_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count,
194 char *modif)
205{
206 db_expr_t value;
207
208 if (modif[0] != '\0')
209 db_print_format = modif[0];
210
211 switch (db_print_format) {
212 case 'a':

--- 24 unchanged lines hidden (view full) ---

237 else
238 db_printf("\\%03o", (int)value);
239 break;
240 }
241 db_printf("\n");
242}
243
244void
195{
196 db_expr_t value;
197
198 if (modif[0] != '\0')
199 db_print_format = modif[0];
200
201 switch (db_print_format) {
202 case 'a':

--- 24 unchanged lines hidden (view full) ---

227 else
228 db_printf("\\%03o", (int)value);
229 break;
230 }
231 db_printf("\n");
232}
233
234void
245db_print_loc_and_inst(loc)
246 db_addr_t loc;
235db_print_loc_and_inst(db_addr_t loc)
247{
248 db_printsym(loc, DB_STGY_PROC);
249 db_printf(":\t");
250 (void) db_disasm(loc, TRUE);
251}
252
253/*
254 * Search for a value in memory.
255 * Syntax: search [/bhl] addr value [mask] [,count]
256 */
257void
236{
237 db_printsym(loc, DB_STGY_PROC);
238 db_printf(":\t");
239 (void) db_disasm(loc, TRUE);
240}
241
242/*
243 * Search for a value in memory.
244 * Syntax: search [/bhl] addr value [mask] [,count]
245 */
246void
258db_search_cmd(dummy1, dummy2, dummy3, dummy4)
259 db_expr_t dummy1;
260 boolean_t dummy2;
261 db_expr_t dummy3;
262 char * dummy4;
247db_search_cmd(db_expr_t dummy1, boolean_t dummy2, db_expr_t dummy3,
248 char *dummy4)
263{
264 int t;
265 db_addr_t addr;
266 int size;
267 db_expr_t value;
268 db_expr_t mask;
269 db_expr_t count;
270

--- 47 unchanged lines hidden (view full) ---

318 count = -1; /* effectively forever */
319 }
320 db_skip_to_eol();
321
322 db_search(addr, size, value, mask, count);
323}
324
325static void
249{
250 int t;
251 db_addr_t addr;
252 int size;
253 db_expr_t value;
254 db_expr_t mask;
255 db_expr_t count;
256

--- 47 unchanged lines hidden (view full) ---

304 count = -1; /* effectively forever */
305 }
306 db_skip_to_eol();
307
308 db_search(addr, size, value, mask, count);
309}
310
311static void
326db_search(addr, size, value, mask, count)
327 register
328 db_addr_t addr;
329 int size;
330 db_expr_t value;
331 db_expr_t mask;
332 unsigned int count;
312db_search(db_addr_t addr, int size, db_expr_t value, db_expr_t mask,
313 unsigned int count)
333{
334 while (count-- != 0) {
335 db_prev = addr;
336 if ((db_get_value(addr, size, FALSE) & mask) == value)
337 break;
338 addr += size;
339 }
340 db_next = addr;
341}
314{
315 while (count-- != 0) {
316 db_prev = addr;
317 if ((db_get_value(addr, size, FALSE) & mask) == value)
318 break;
319 addr += size;
320 }
321 db_next = addr;
322}